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:
- NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, 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.
|
Method Summary |
protected boolean |
allowPageConfiguration(String pageConfiguration)
Checks if a page configuration is allowed to render. |
WOActionResults |
dynamicPageForActionNamed(String anActionName)
|
EOFetchSpecification |
fetchSpecificationFromRequest(String entityName)
Retrieves and executes the fetch specification given in the request. |
WOActionResults |
forbiddenAction()
Returns a response with a 401 (access denied) message. |
String |
keyPathFromRequest()
|
protected EOEditingContext |
newEditingContext()
For edit pages, we always use a fresh editing context. |
WOActionResults |
performActionNamed(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(D2WContext context,
EditPageInterface epi,
String entityName)
|
protected WOActionResults |
prepareErrorPage(D2WContext d2wContext,
ErrorPageInterface epi)
Returns an error page and sets the message to the key __message. |
protected void |
prepareInspectPage(D2WContext context,
InspectPageInterface ipi,
String entityName)
|
protected void |
prepareListPage(D2WContext context,
ListPageInterface lpi,
String entityName)
|
protected void |
prepareQueryPage(D2WContext context,
QueryPageInterface qpi,
String entityName)
|
WOComponent |
previousPageFromRequest()
|
Number |
primaryKeyFromRequest()
Deprecated. use primaryKeyFromRequest(EOEditingContext ec, String entityName) |
NSDictionary |
primaryKeyFromRequest(EOEditingContext ec,
String entityName)
|
EOArrayDataSource |
relationshipArrayFromRequest(EOEditingContext ec,
EOClassDescription cd)
|
WOActionResults |
reportException(Exception ex)
Creates an error page with the given exception. |
| Methods inherited from class er.extensions.appserver.ERXDirectAction |
browser, canPerformActionWithPasswordKey, databaseConsoleAction, dumpCreatedKeysAction, editLocalizedFilesAction, emptyAction, eventsAction, eventsSetupAction, forceGCAction, log4jAction, logoutAction, pageWithName, remoteShellAction, resetStatsAction, showOpenEditingContextLockTracesAction, statsAction, systemPropertyAction, testAction |
| 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 |
log
protected static final Logger log
- logging support
actionLog
protected final Logger actionLog
ERD2WDirectAction
public ERD2WDirectAction(WORequest r)
- Public constructor
- Parameters:
r - current request
newEditingContext
protected EOEditingContext newEditingContext()
- For edit pages, we always use a fresh editing context.
fetchSpecificationFromRequest
public EOFetchSpecification fetchSpecificationFromRequest(String entityName)
- Retrieves and executes the fetch specification given in the request.
primaryKeyFromRequest
public Number primaryKeyFromRequest()
- Deprecated. use primaryKeyFromRequest(EOEditingContext ec, String entityName)
primaryKeyFromRequest
public NSDictionary primaryKeyFromRequest(EOEditingContext ec,
String entityName)
previousPageFromRequest
public WOComponent previousPageFromRequest()
keyPathFromRequest
public String keyPathFromRequest()
relationshipArrayFromRequest
public EOArrayDataSource relationshipArrayFromRequest(EOEditingContext ec,
EOClassDescription cd)
prepareEditPage
protected void prepareEditPage(D2WContext context,
EditPageInterface epi,
String entityName)
prepareInspectPage
protected void prepareInspectPage(D2WContext context,
InspectPageInterface ipi,
String entityName)
prepareQueryPage
protected void prepareQueryPage(D2WContext context,
QueryPageInterface qpi,
String entityName)
prepareListPage
protected void prepareListPage(D2WContext context,
ListPageInterface lpi,
String entityName)
dynamicPageForActionNamed
public WOActionResults dynamicPageForActionNamed(String anActionName)
prepareErrorPage
protected WOActionResults prepareErrorPage(D2WContext d2wContext,
ErrorPageInterface epi)
- Returns an error page and sets the message to the key
__message.
- Returns:
reportException
public WOActionResults reportException(Exception ex)
- Creates an error page with the given exception.
- Parameters:
ex -
- Returns:
allowPageConfiguration
protected boolean allowPageConfiguration(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 WOActionResults forbiddenAction()
- Returns a response with a 401 (access denied) message. Override this for something more user friendly.
performActionNamed
public WOActionResults performActionNamed(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.