com.webobjects.appserver
Class WODirectAction
java.lang.Object
|
+--com.webobjects.appserver.WOAction
|
+--com.webobjects.appserver.WODirectAction
- All Implemented Interfaces:
- NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation
- Direct Known Subclasses:
- D2WActions, WOAdminAction, WOEventDisplay, WOEventSetup, WOProjectBuilderAction, WOStats
- public class WODirectAction
- extends WOAction
- implements NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation
WODirectAction is an abstract class that defines the interface for direct
action classes. You subclass WODirectAction to provide an object that is a
repository for action methods.
WODirectAction provides the simplest interface for adding logic and custom
code to your WebObjects application. WODirectAction objects are instantiated
when a URL requested by a client browser is sent to the WebObjects
application. The WODirectActionRequestHandler
determines the proper class
and action to be invoked and then passes control to the WODirectAction
subclass.
In contrast to a WOComponent-based action, a direct action is well-defined
by the URL that invokes it. For example, the following URL will invoke the
method findEmployeeAction
on the subclass of WODirectAction called
Common:
http://localhost/cgi-bin/WebObjects/Myapp.woa/wa/Common/findEmployee
A subclass of WODirectAction is a repository for action methods. New
WebObjects applications contain a default implementation of WODirectAction
subclass called DirectAction
. The DirectAction class is used when no class is
specified in the URL.
In summary, here are some URLs and actions they invoke:
This URL... | Invokes this method... |
.../MyApp.woa/wa/ | defaultAction on class DirectAction |
.../MyApp.woa/wa/find | findAction on class DirectAction, if it exists, or defaultAction on class find otherwise |
.../MyApp.woa/wa/find/ | same as .../MyApp.woa/wa/find |
.../MyApp.woa/wa/Common/find | findAction on class Common |
.../MyApp.woa/wa/Common/ | CommonAction on class DirectAction, if it exists, or defaultAction on class Common otherwise |
WODirectActionRequestHandler only invokes methods on subclasses of
WODirectAction. If the specified class or action doesn't exist,
WODirectActionRequestHandler throws an exception.
Constructor Summary |
WODirectAction(WORequest aRequest)
Subclasses must override to provide any additional initialization. |
Methods inherited from class com.webobjects.appserver.WOAction |
canAccessFieldsDirectly, context, debugString, existingSession, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, initializeRequestSessionIDInContext, languages, logString, pageWithName, request, session, setLanguages, takeValueForKey, takeValueForKeyPath, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, valueForKey, valueForKeyPath |
actionText
public static final String actionText
WODirectAction
public WODirectAction(WORequest aRequest)
- Subclasses must override to provide any additional initialization.
- Parameters:
aRequest
- the request to be processed
defaultAction
public WOActionResults defaultAction()
- Returns a WOActionResults object that is the result of sending
generateResponse()
to the page named "Main".
- Returns:
- a WOActionResults containing the generated response.
getSessionIDForRequest
public String getSessionIDForRequest(WORequest aRequest)
- Returns the session ID, or
null
if one does not exist.
Searchs for aRequest
's session ID, first in the form values,
then in the cookies.
- Overrides:
getSessionIDForRequest
in class WOAction
- Following copied from class:
com.webobjects.appserver.WOAction
- Parameters:
aRequest
- the request being handled- Returns:
- the session ID for the request, or
null
performActionNamed
public WOActionResults performActionNamed(String anActionName)
- Performs the action with the specified name and returns the result
of that action. The default implementation appends "Action"
to
anActionName
and tries to invoke the resulting method name.
Override this method to change how actions are dispatched.
- Overrides:
performActionNamed
in class WOAction
- Parameters:
anActionName
- name of the action- Returns:
- a WOActionResults containing the result of the direct action
takeFormValueArraysForKeyArray
public void takeFormValueArraysForKeyArray(NSArray aKeyArray)
- Performs
takeValueForKey
on each key in aKeyArray
using
values from the receiver's request.
This method uses an NSArray for each form value. This is useful
when a user can select multiple items for a form value, such as
a WOBrowser. If a form value contains only one item, this method
uses an NSArray with one object. To use single objects as form
values use takeFormValuesForKeyArray
.
- Parameters:
aKeyArray
- an array of keys- See Also:
WOAction.takeValueForKey(Object value, String key)
,
takeFormValuesForKeyArray(NSArray aKeyArray)
takeFormValuesForKeyArray
public void takeFormValuesForKeyArray(NSArray aKeyArray)
- Performs
takeValueForKey
on the each key in aKeyArray
using
values from the receiver's request.
This method uses an a single object for each form value. If a form
value contains more than one item, such as a WOBrowser, this method
uses the first item in the array. To use arrays of objects as form
values, use takeFormValueArraysForKeyArray
.
- Parameters:
aKeyArray
- an array of keys- See Also:
WOAction.takeValueForKey(Object value, String key)
,
takeFormValueArraysForKeyArray(NSArray aKeyArray)
Copyright © 2003 Apple Computer, Inc.