WebObjects 5.2

com.webobjects.appserver
Class WOAction

java.lang.Object
  |
  +--com.webobjects.appserver.WOAction
Direct Known Subclasses:
WODirectAction

public abstract class WOAction
extends Object


Field Summary
static String actionText
           
 
Constructor Summary
WOAction(WORequest aRequest)
          Subclasses must override to provide any additional initialization.
 
Method Summary
static boolean canAccessFieldsDirectly()
          WOAction'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.
 WOSession existingSession()
          Restores the session based on the request.
abstract  String getSessionIDForRequest(WORequest aRequest)
          Get and return the session ID for the request, if one exists.
 Object handleQueryWithUnboundKey(String key)
           
 void handleTakeValueForUnboundKey(Object value, String key)
           
 void initializeRequestSessionIDInContext(WOContext aContext)
           
 NSArray languages()
          Returns an NSArray of languages for which the action is localized.
static void logString(String string)
          Deprecated. Use NSLog instead
 WOComponent pageWithName(String aComponentName)
          Returns the page with given name.
abstract  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 Action 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 setLanguages(NSArray someLanguages)
          Sets the languages for which the action is localized.
 void takeValueForKey(Object value, String key)
           
 void takeValueForKeyPath(Object value, String keyPath)
           
 String toString()
           
 void unableToSetNullForKey(String key)
           
 Object validateTakeValueForKeyPath(Object value, String keyPath)
           
 Object validateValueForKey(Object value, String key)
           
 Object valueForKey(String key)
           
 Object valueForKeyPath(String keyPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionText

public static final String actionText
Constructor Detail

WOAction

public WOAction(WORequest aRequest)
Subclasses must override to provide any additional initialization.
Parameters:
aRequest - the request to be processed
Method Detail

canAccessFieldsDirectly

public static boolean canAccessFieldsDirectly()
WOAction'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.
Returns:
true only if key can access fields directly, false otherwise

context

public WOContext context()
Returns the current WOContext object.
Returns:
the WODirectAction's current WOContext

debugString

public static void debugString(String string)
Deprecated. use NSLog instead.

Deprecated. Use NSLog instead.
Parameters:
string - message to be logged
See Also:
NSLog

existingSession

public WOSession existingSession()
Restores the session based on the request. If the request did not have a session ID or the session ID referred to a non-existent session, then this method returns null. To determine if a session failed to restore, check the request's session ID to see if it non-null and if so, call this method to check its result.
Returns:
a WOSession object which represents periods during which access to a WebObjects application and its resources is granted to a particular client
See Also:
session()

getSessionIDForRequest

public abstract String getSessionIDForRequest(WORequest aRequest)
Get and return the session ID for the request, if one exists. Otherwise, return null.
Parameters:
aRequest - the request being handled
Returns:
the session ID for the request, or null

handleQueryWithUnboundKey

public Object handleQueryWithUnboundKey(String key)

handleTakeValueForUnboundKey

public void handleTakeValueForUnboundKey(Object value,
                                         String key)

initializeRequestSessionIDInContext

public void initializeRequestSessionIDInContext(WOContext aContext)

languages

public NSArray languages()
Returns an NSArray of languages for which the action is localized. The order of language strings returned indicates the preferred order of languages. This is initialized from the user's browser preferences unless explicitly set with setLanguages.
Returns:
NSArray of languages supported by the action, in order of preference
See Also:
setLanguages(NSArray languages)

logString

public static void logString(String string)
Deprecated. Use NSLog instead

Deprecated. Use NSLog instead. This is simply a cover method for NSLog.err.appendln(string). You should use NSLog instead.
Parameters:
string - message to be logged
See Also:
NSLog

pageWithName

public WOComponent pageWithName(String aComponentName)
Returns the page with given name. This is equivalent to calling pageWithName on the WOApplication object.
Parameters:
aComponentName - the name of the WOComponent
Returns:
the WOComponent with the specified name

performActionNamed

public abstract WOActionResults performActionNamed(String anActionName)
Performs the action with the specified name and returns the result of that action. The default implementation appends the actionText to anActionName and tries to invoke the resulting method name. Override this method to change how actions are dispatched.
Parameters:
anActionName - name of the action
Returns:
a WOActionResults containing the result of the direct action

request

public WORequest request()
Returns the WORequest that created this Action object.
Returns:
WORequest object that started the action in the first place

session

public WOSession session()
If there is no session, this method first tries to restore the session that the request's session ID refers to. If the request has no session ID -- which is a possibility if the application is written entirely with direct actions -- this method creates a new session and returns it. If the session ID refers to a session that doesn't exist or cannot be restored, this method returns null.

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.

Returns:
the current session or null if the the session ID is incorrect
See Also:
existingSession(), WOSession.SessionDidRestoreNotification

setLanguages

public void setLanguages(NSArray someLanguages)
Sets the languages for which the action is localized. The ordering of language strings in the array determines the order in which the application will search .lproj directories for localized strings, images, and component definitions.

Note that the language setting only last for an action and does not persist across actions. If you want the language setting to persist, you should consider creating a temporary session and use setLanguages in that session. If you set the language setting in a session, that setting has precedence.

Parameters:
someLanguages - the array of languages for the action
See Also:
languages(), WOSession.setLanguages(NSArray)

takeValueForKey

public void takeValueForKey(Object value,
                            String key)

takeValueForKeyPath

public void takeValueForKeyPath(Object value,
                                String keyPath)

toString

public String toString()
Overrides:
toString in class Object

unableToSetNullForKey

public void unableToSetNullForKey(String key)

validateTakeValueForKeyPath

public Object validateTakeValueForKeyPath(Object value,
                                          String keyPath)
                                   throws NSValidation.ValidationException

validateValueForKey

public Object validateValueForKey(Object value,
                                  String key)
                           throws NSValidation.ValidationException

valueForKey

public Object valueForKey(String key)

valueForKeyPath

public Object valueForKeyPath(String keyPath)

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.