|
WebObjects 5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.appserver.WODirectAction
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/Common/find | findAction on class Common |
WODirectActionRequestHandler only invokes methods on subclasses of WODirectAction. If the specified class or action doesn't exist, WODirectActionRequestHandler throws an exception.
Inner classes inherited from class com.webobjects.foundation.NSKeyValueCoding |
NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor |
Inner classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions |
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility |
Inner classes inherited from class com.webobjects.foundation.NSValidation |
NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NullValue |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
KeyPathSeparator |
Constructor Summary | |
WODirectAction(WORequest aRequest)
Subclasses must override to provide any additional initialization. |
Method Summary | |
static boolean |
canAccessFieldsDirectly()
WODirectAction's implementation of this static method returns true , indicating that key-value coding is allowed to access fields
in this object if an appropriate method isn't present. |
WOContext |
context()
Returns the current WOContext object. |
static void |
debugString(String string)
Deprecated. use NSLog instead. |
WOActionResults |
defaultAction()
Returns a WOActionResults object that is the result of sending generateResponse() to the page named "Main". |
WOSession |
existingSession()
Restores the session based on the request. |
Object |
handleQueryWithUnboundKey(String key)
Conformance to NSKeyValueCoding.ErrorHandling. |
void |
handleTakeValueForUnboundKey(Object value,
String key)
Conformance to NSKeyValueCoding.ErrorHandling. |
static void |
logString(String string)
This is simply a cover method for NSLog.err.appendln(string) . |
WOComponent |
pageWithName(String aComponentName)
Returns the page with given name. |
WOActionResults |
performActionNamed(String anActionName)
Performs the action with the specified name and returns the result of that action. |
WORequest |
request()
Returns the WORequest that created this DirectAction object. |
WOSession |
session()
If there is no session, this method first tries to restore the session that the request's session ID refers to. |
void |
takeFormValueArraysForKeyArray(NSArray aKeyArray)
Performs takeValueForKey on each key in aKeyArray using
values from the receiver's request. |
void |
takeFormValuesForKeyArray(NSArray aKeyArray)
Performs takeValueForKey on the each key in aKeyArray using
values from the receiver's request. |
void |
takeValueForKey(Object value,
String key)
Conformance to NSKeyValueCoding. |
void |
takeValueForKeyPath(Object value,
String keyPath)
Conformance to NSKeyValueCodingAdditions. |
String |
toString()
|
void |
unableToSetNullForKey(String key)
Conformance to NSKeyValueCoding.ErrorHandling. |
Object |
validateTakeValueForKeyPath(Object value,
String keyPath)
Conformance to NSValidation |
Object |
validateValueForKey(Object value,
String key)
Conformance to NSValidation. |
Object |
valueForKey(String key)
Conformance to NSKeyValueCoding. |
Object |
valueForKeyPath(String keyPath)
Conformance to NSKeyValueCodingAdditions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public WODirectAction(WORequest aRequest)
aRequest
- a new context object for a given requestMethod Detail |
public static boolean canAccessFieldsDirectly()
true
, indicating that key-value coding is allowed to access fields
in this object if an appropriate method isn't present.true
only if key can access fields directly, false
otherwisepublic WOContext context()
public static void debugString(String string)
string
- message to be loggedNSLog
public WOActionResults defaultAction()
generateResponse()
to the page named "Main".public WOSession existingSession()
session()
public Object handleQueryWithUnboundKey(String key)
handleQueryWithUnboundKey
in interface NSKeyValueCoding.ErrorHandling
key
- one of the attributes of the receiver's requestpublic void handleTakeValueForUnboundKey(Object value, String key)
handleTakeValueForUnboundKey
in interface NSKeyValueCoding.ErrorHandling
value
- the property identified by key is set to thiskey
- identifies the property of an objectpublic static void logString(String string)
NSLog.err.appendln(string)
.
You should use NSLog instead.string
- message to be loggedNSLog
public WOComponent pageWithName(String aComponentName)
aComponentName
- the name of the WOComponentpublic WOActionResults performActionNamed(String anActionName)
anActionName
and tries to invoke the resulting method name.
Override this method to change how actions are dispatched.anActionName
- name of the actionpublic WORequest request()
public WOSession session()
This method may call WOApplication's restoreSessionWithID
, which posts
a SessionDidRestoreNotification
. If the session does not exist or cannot be restored,
the notification is posted with a null
session for parameter
(the only indication that a session time out has occurred),
and a new session object is created.
This method may also call WOApplication's createSessionForRequest
If the session can not be created, an IllegalStateException
is thrown,
otherwise, a SessionDidCreateNotification
is posted and the new session is returned.
existingSession()
,
WOSession.SessionDidRestoreNotification
public void takeFormValueArraysForKeyArray(NSArray aKeyArray)
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
.
aKeyArray
- an array of keystakeValueForKey(Object value, String key)
,
takeFormValuesForKeyArray(NSArray aKeyArray)
public void takeFormValuesForKeyArray(NSArray aKeyArray)
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
.aKeyArray
- an array of keystakeValueForKey(Object value, String key)
,
takeFormValueArraysForKeyArray(NSArray aKeyArray)
public void takeValueForKey(Object value, String key)
takeValueForKey
in interface NSKeyValueCoding
key
- identifies the property to be setvalue
- the value to which the property specified by key
should be setpublic void takeValueForKeyPath(Object value, String keyPath)
takeValueForKeyPath
in interface NSKeyValueCodingAdditions
keyPath
- identifies a derived property of the receivervalue
- value to which the derived property identified by
keyPath
will be setpublic String toString()
toString
in class Object
public void unableToSetNullForKey(String key)
unableToSetNullForKey
in interface NSKeyValueCoding.ErrorHandling
key
- one of the keys in receiver's requestpublic Object validateTakeValueForKeyPath(Object value, String keyPath) throws NSValidation.ValidationException
validateTakeValueForKeyPath
in interface NSValidation
value
- value of receiver's requestkeyPath
- the string to identify each key in the keyarrayNSValidation.ValidationException
- when value isn't legalpublic Object validateValueForKey(Object value, String key) throws NSValidation.ValidationException
validateValueForKey
in interface NSValidation
value
- the receiver's property named by keykey
- identifies the property of an objectNSValidation.ValidationException
- when value isn't legalpublic Object valueForKey(String key)
valueForKey
in interface NSKeyValueCoding
key
- identifies the property of an objectkey
public Object valueForKeyPath(String keyPath)
valueForKeyPath
in interface NSKeyValueCodingAdditions
keyPath
- identifies the derived property of an objectkeyPath
|
Last updated Thu Jan 10 18:10:21 PST 2002. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |