er.directtoweb
Class ERD2WDirectAction
java.lang.Object
com.webobjects.appserver.WOAction
com.webobjects.appserver.WODirectAction
er.extensions.appserver.ERXDirectAction
er.directtoweb.ERD2WDirectAction
- All Implemented Interfaces:
- com.webobjects.foundation.NSKeyValueCoding, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCodingAdditions, com.webobjects.foundation.NSValidation
public abstract class ERD2WDirectAction
- extends ERXDirectAction
Automatically creates page configurations from URLs.
Examples:
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/QueryAll
will create an query page all entities.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/QueryArticle
will create an query page for articles.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/QueryArticle?__fs=findNewArticles
will create an query page for fetch spec "findNewArticles". This will only work if your rules return a ERD2WQueryPageWithFetchSpecification.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/InspectArticle?__key=<articleid>
will create an inpect page for the given article.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/EditArticle?__key=<articleid>
will create an edit page for the given article.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/CreateArticle
will create an edit page for a newly created article.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/ListArticle?__key=<userid>&__keypath=User.articles
will list the articles of the given user.
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/ListArticle?__fs=recentArticles&authorName=*foo*
will list the articles by calling the fetch spec "recentArticles". When the
fetch spec has an "authorName" binding, it is set to "*foo*".
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/ListArticle?__fs=&author.name=*foo*&__fs_fetchLimit=0
will list the articles by creating a fetch spec with the supplied attributes.
When the value contains "*", then it will be regarded as a LIKE query, otherwise as a EQUAL
http://localhost/cgi-bin/WebObjects/MyApp.woa/wa/ErrorSomeStuff?__message=Some+Test
will create an error page with the title "Error Some Stuff" (or whatever your localizer does with it) and the message "Some Test".
To provide some security, you should override allowPageConfiguration(String)
. Also, this
class is abstract, so you need to subclass it.
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility |
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding |
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor |
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSValidation |
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException |
Field Summary |
protected org.apache.log4j.Logger |
actionLog
|
protected static org.apache.log4j.Logger |
log
logging support |
Fields inherited from class com.webobjects.appserver.WODirectAction |
actionText |
Fields inherited from class com.webobjects.appserver.WOAction |
_actionClasses, _context |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling |
_CLASS |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NullValue |
Fields inherited from interface com.webobjects.foundation.NSValidation |
_CLASS |
Constructor Summary |
ERD2WDirectAction(com.webobjects.appserver.WORequest r)
Public constructor |
Method Summary |
protected boolean |
allowPageConfiguration(java.lang.String pageConfiguration)
Checks if a page configuration is allowed to render. |
com.webobjects.appserver.WOActionResults |
dynamicPageForActionNamed(java.lang.String anActionName)
|
com.webobjects.eocontrol.EOFetchSpecification |
fetchSpecificationFromRequest(java.lang.String entityName)
Retrieves and executes the fetch specification given in the request. |
com.webobjects.appserver.WOActionResults |
forbiddenAction()
Returns a response with a 401 (access denied) message. |
java.lang.String |
keyPathFromRequest()
|
protected com.webobjects.eocontrol.EOEditingContext |
newEditingContext()
For edit pages, we always use a fresh editing context. |
com.webobjects.appserver.WOActionResults |
performActionNamed(java.lang.String anActionName)
Overrides the default implementation to try to look up the action as a
page configuration if there is no method with the wanted name. |
protected void |
prepareEditPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.EditPageInterface epi,
java.lang.String entityName)
|
protected com.webobjects.appserver.WOActionResults |
prepareErrorPage(com.webobjects.directtoweb.D2WContext d2wContext,
com.webobjects.directtoweb.ErrorPageInterface epi)
Returns an error page and sets the message to the key __message . |
protected void |
prepareInspectPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.InspectPageInterface ipi,
java.lang.String entityName)
|
protected void |
prepareListPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.ListPageInterface lpi,
java.lang.String entityName)
|
protected void |
prepareQueryPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.QueryPageInterface qpi,
java.lang.String entityName)
|
com.webobjects.appserver.WOComponent |
previousPageFromRequest()
|
java.lang.Number |
primaryKeyFromRequest()
Deprecated. use primaryKeyFromRequest(EOEditingContext ec, String entityName) |
com.webobjects.foundation.NSDictionary |
primaryKeyFromRequest(com.webobjects.eocontrol.EOEditingContext ec,
java.lang.String entityName)
|
protected java.lang.Object |
qualifierValueForAttribute(com.webobjects.eoaccess.EOAttribute attribute,
java.lang.String stringValue)
Overwrite for custom value conversion. |
com.webobjects.eocontrol.EOArrayDataSource |
relationshipArrayFromRequest(com.webobjects.eocontrol.EOEditingContext ec,
com.webobjects.eocontrol.EOClassDescription cd)
|
com.webobjects.appserver.WOActionResults |
reportException(java.lang.Exception ex)
Creates an error page with the given exception. |
Methods inherited from class er.extensions.appserver.ERXDirectAction |
browser, canPerformActionWithPasswordKey, closeHTTPSessionAction, databaseConsoleAction, dumpCreatedKeysAction, editLocalizedFilesAction, emptyAction, eoAdaptorDebuggingAction, eventsAction, eventsSetupAction, flushComponentCacheAction, forceGCAction, log4jAction, logoutAction, pageWithName, remoteShellAction, resetStatsAction, showOpenEditingContextLockTracesAction, statsAction, systemPropertyAction, testAction |
Methods inherited from class com.webobjects.appserver.WODirectAction |
_componentAction, defaultAction, getSessionIDForRequest, takeFormValueArraysForKeyArray, takeFormValuesForKeyArray |
Methods inherited from class com.webobjects.appserver.WOAction |
_isActionOnClass, _methodForAction, _preloadAllActionsOnClass, canAccessFieldsDirectly, context, debugString, existingSession, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, initializeRequestSessionIDInContext, languages, logString, pageWithName, request, session, setLanguages, takeValueForKey, takeValueForKeyPath, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, valueForKey, valueForKeyPath |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling |
handleQueryWithUnboundKey, handleTakeValueForUnboundKey, unableToSetNullForKey |
Methods inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
takeValueForKeyPath, valueForKeyPath |
Methods inherited from interface com.webobjects.foundation.NSKeyValueCoding |
takeValueForKey, valueForKey |
Methods inherited from interface com.webobjects.foundation.NSValidation |
validateTakeValueForKeyPath, validateValueForKey |
log
protected static final org.apache.log4j.Logger log
- logging support
actionLog
protected final org.apache.log4j.Logger actionLog
ERD2WDirectAction
public ERD2WDirectAction(com.webobjects.appserver.WORequest r)
- Public constructor
- Parameters:
r
- current request
newEditingContext
protected com.webobjects.eocontrol.EOEditingContext newEditingContext()
- For edit pages, we always use a fresh editing context.
qualifierValueForAttribute
protected java.lang.Object qualifierValueForAttribute(com.webobjects.eoaccess.EOAttribute attribute,
java.lang.String stringValue)
- Overwrite for custom value conversion.
- Parameters:
attribute
- stringValue
-
fetchSpecificationFromRequest
public com.webobjects.eocontrol.EOFetchSpecification fetchSpecificationFromRequest(java.lang.String entityName)
- Retrieves and executes the fetch specification given in the request.
primaryKeyFromRequest
public java.lang.Number primaryKeyFromRequest()
- Deprecated. use primaryKeyFromRequest(EOEditingContext ec, String entityName)
primaryKeyFromRequest
public com.webobjects.foundation.NSDictionary primaryKeyFromRequest(com.webobjects.eocontrol.EOEditingContext ec,
java.lang.String entityName)
previousPageFromRequest
public com.webobjects.appserver.WOComponent previousPageFromRequest()
keyPathFromRequest
public java.lang.String keyPathFromRequest()
relationshipArrayFromRequest
public com.webobjects.eocontrol.EOArrayDataSource relationshipArrayFromRequest(com.webobjects.eocontrol.EOEditingContext ec,
com.webobjects.eocontrol.EOClassDescription cd)
prepareEditPage
protected void prepareEditPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.EditPageInterface epi,
java.lang.String entityName)
prepareInspectPage
protected void prepareInspectPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.InspectPageInterface ipi,
java.lang.String entityName)
prepareQueryPage
protected void prepareQueryPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.QueryPageInterface qpi,
java.lang.String entityName)
prepareListPage
protected void prepareListPage(com.webobjects.directtoweb.D2WContext context,
com.webobjects.directtoweb.ListPageInterface lpi,
java.lang.String entityName)
dynamicPageForActionNamed
public com.webobjects.appserver.WOActionResults dynamicPageForActionNamed(java.lang.String anActionName)
prepareErrorPage
protected com.webobjects.appserver.WOActionResults prepareErrorPage(com.webobjects.directtoweb.D2WContext d2wContext,
com.webobjects.directtoweb.ErrorPageInterface epi)
- Returns an error page and sets the message to the key
__message
.
reportException
public com.webobjects.appserver.WOActionResults reportException(java.lang.Exception ex)
- Creates an error page with the given exception.
- Parameters:
ex
-
allowPageConfiguration
protected boolean allowPageConfiguration(java.lang.String pageConfiguration)
- Checks if a page configuration is allowed to render.
Override for a more intelligent access scheme as the default just returns true.
- Parameters:
pageConfiguration
-
forbiddenAction
public com.webobjects.appserver.WOActionResults forbiddenAction()
- Returns a response with a 401 (access denied) message. Override this for something more user friendly.
performActionNamed
public com.webobjects.appserver.WOActionResults performActionNamed(java.lang.String anActionName)
- Overrides the default implementation to try to look up the action as a
page configuration if there is no method with the wanted name. This
implementation catches NoSuchMethodException more or less silently, so be
sure to turn on logging.
- Overrides:
performActionNamed
in class ERXDirectAction
Copyright © 2002 – 2007 Project Wonder.