|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.appserver.WOSession
WOSession objects represent periods of user interaction during which access to a WebObjects application and its resources is granted to a particular client (typically a browser). An application can have many concurrent sessions, each with its own special "view" of the application and its own set of data values. For example: one client can be accessing a "catalog" application, navigating from page to page and filling a virtual shopping cart with items for purchase. Another client can be accessing the same application at the same time, but visiting different pages and placing different items in his or her shopping cart. Neither client will see anything to indicate that they are not the only person using the application.
Perhaps the most important purpose of a WOSession object is to encapsulate state for a user session. After the application handles a request, it stores the WOSession until the next request in the session occurs. All of the information that is important for maintaining continuity throughout the session is preserved, as is the integrity of session data. This data not only persists between requests but is kept separate from that of all other sessions.
The application uses a session ID to identify a session object. Upon receiving a request that is not identified with a session ID, the application creates a new session and assigns it a session ID -- a unique, randomly generated string. This session ID will appear in the URL between the application name and the page name.
When you develop an application, you identify data with session-wide scope by declaring instance variables in your subclass of WOSession. As the client interacts with the application, before the end of each cycle of the request-response loop, you should ensure that the instance variables hold the current session values.
At the end of each cycle of the request-response loop, the application stores the WOSession object according to the storage strategy implemented by the chosen WOSessionStore. When the application receives the next request in a given session, it restores the WOSession, using the session ID stored in the request as key. To be stored and restored according to any WOSessionStore strategy, a WOSession must be convertible to a stream. To accomplish this, WOSession implements the interface java.io.Serializable; any custom subclasses should also do so.
Because storage of sessions in application memory can consume large amounts of
memory over time, WOSession includes methods for controlling the lifespan of session
objects. The setTimeOut
method sets a period of inactivity after which
the session is terminated. The terminate
method explicitly ends a session.
The WOSession class provides several other methods useful for tasks ranging from localization to database access:
takeValuesFromRequest, invokeAction
,
and appendToResponse
) as well as awake
and sleep
.defaultEditingContext
method gives each WOSession
object in an application its own Enterprise Objects editing context.setObjectForKey
and objectForKey
it can store and retrieve values as needed. This
mechanism is especially useful for reusable components.setLanguages
method you can store a list of the languages supported
by the session. The sequence of language strings in the list indicates the order
of language preference for a particular session. Several resource-access methods in
WOResourceManager, WOApplication, and WOComponent refer to the languages
array when they locate such things as localized strings, images, and sounds.setDistributionEnabled
method. If the flag set by this method is false
, transactions of the session are
restricted to a single application instance. If this is the case, the application instance number
as well as the application host name are appended to the URL.
setTimeOut(double seconds)
,
terminate()
,
takeValuesFromRequest(WORequest aRequest, WOContext aContext)
,
invokeAction(WORequest aRequest, WOContext aContext)
,
appendToResponse(WOResponse aResponse, WOContext aContext)
,
awake()
,
sleep()
,
defaultEditingContext()
,
setObjectForKey(Object anObject, String key)
,
objectForKey(String key)
,
setLanguages(NSArray languages)
,
languages()
,
setDistributionEnabled(boolean aFlag)
,
WOSessionStore
, Serialized FormInner 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 |
Field Summary | |
static String |
SessionDidCreateNotification
Sent at the end of session creation (including awake ). |
static String |
SessionDidRestoreNotification
Sent after the session is fully restored (including awake ). |
static String |
SessionDidTimeOutNotification
Sent when a session times out but before it is released. |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NullValue |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
KeyPathSeparator |
Constructor Summary | |
WOSession()
Creates a WOSession with a randomly generated session ID and a session time-out of WOApplication.sessionTimeOut() seconds. |
|
WOSession(String aSessionID)
Creates a WOSession with session ID aSessionId and a session time-out
of WOApplication.sessionTimeOut() seconds. |
Method Summary | |
boolean |
allowedToViewEvents()
Returns whether or not the session is allowed to view the WOEvents* pages. |
boolean |
allowedToViewStatistics()
Returns whether or not the session is allowed to view the WOStats page. |
void |
appendToResponse(WOResponse aResponse,
WOContext aContext)
Invoked on the WOSession object during the final phase of the request-response loop. |
void |
awake()
Invoked on the WOSession object at the beginning of a WOSession's involvement in a cycle of the request-response loop, giving the WOSession an opportunity to initialize its instance variables or perform setup operations. |
static boolean |
canAccessFieldsDirectly()
Return true in all cases, indicating that key-value coding is
allowed to access fields in this object if an appropriate accessor method isn't present. |
Object |
clone()
|
WOContext |
context()
Returns the WOContext object for the current transaction. |
static void |
debugString(String string)
Deprecated. use com.webobjects.foundation.NSLog instead |
EOEditingContext |
defaultEditingContext()
Returns the default EOEditingContext for the receiver. |
String |
domainForIDCookies()
Returns the path that will be used when creating the rendevous cookie for the application to use with the cookie mechanism for storing session and instance IDs This path is lazily created the first time this method is called using the current request's adaptorPrefix and the application name, including
the .woa extension. |
NSTimestamp |
expirationDateForIDCookies()
Deprecated. this method is deprecated should not be used |
Object |
handleQueryWithUnboundKey(String key)
Invoked from valueForKey when it finds no property binding
for key . |
void |
handleTakeValueForUnboundKey(Object value,
String key)
Invoked from takeValueForKey when it finds no property binding
for key . |
WOActionResults |
invokeAction(WORequest aRequest,
WOContext aContext)
Invoked on the WOSession object during the middle phase of the request-response loop. |
boolean |
isDistributionEnabled()
Returns false by default, since the default WOSessionStore
does not support distributed sessions. |
boolean |
isTerminating()
Returns whether or not the receiver is in the process of terminating. |
NSArray |
languages()
Returns an NSArray of languages for which the session is localized. |
static void |
logString(String string)
Deprecated. use com.webobjects.foundation.NSLog instead |
Object |
objectForKey(String aKey)
Returns an Object stored in the session under a given key. |
void |
removeObjectForKey(String aKey)
Removes the Object stored in the session under a given key. |
WOComponent |
restorePageForContextID(String aContextID)
This method attempts to restore an existing page. |
void |
savePage(WOComponent aPage)
Saves the page instance aPage in the session's page cache. |
void |
savePageInPermanentCache(WOComponent aPageComponent)
Puts aPageComponent into the permanent page cache. |
String |
sessionID()
Return the receivers sessionID . |
void |
setDefaultEditingContext(EOEditingContext editingContext)
Sets the editing context to be returned by defaultEditingContext . |
void |
setDistributionEnabled(boolean aFlag)
Enables or disables the distribution mechanism that effects load balancing among multiple application instances. |
void |
setLanguages(NSArray someLanguages)
Sets the languages for which the session is localized. |
void |
setObjectForKey(Object anObject,
String aKey)
Stores an Object within the session under a given key. |
void |
setStoresIDsInCookies(boolean aFlag)
Enables or disables the use of cookies for storing the session and instance IDs. |
void |
setStoresIDsInURLs(boolean aFlag)
Enables or disables the use of URLs for storing the session and instance IDs. |
void |
setTimeOut(double aTimeInterval)
Set the session time-out in seconds. |
void |
sleep()
Invoked at the conclusion of each request-response loop in which the session is involved, giving the WOSession the opportunity to clean up objects initialized in the awake method. |
NSArray |
statistics()
Returns a list of pages accessed by this session, ordered from first to most recently accessed. |
boolean |
storesIDsInCookies()
Returns whether the cookie mechanism for storing session and instance IDs is enabled. |
boolean |
storesIDsInURLs()
Returns whether the URL mechanism for storing session and instance IDs is enabled. |
void |
takeValueForKey(Object value,
String key)
Sets the value for the property identified by key to value . |
void |
takeValueForKeyPath(Object value,
String keyPath)
Sets the value for the property identified by keyPath
to value . |
void |
takeValuesFromRequest(WORequest aRequest,
WOContext aContext)
Invoked on the WOSession object during the first phase of the the request-response loop. |
void |
terminate()
Causes the session to terminate after the conclusion of the current request-response loop. |
double |
timeOut()
Returns the interval in seconds during which the session can remain idle before it times out. |
int |
timeOutForIDCookies()
Deprecated. this method is deprecated should not be used |
long |
timeOutMillis()
Returns the interval in milliseconds during which the session can remain idle before it times out. |
String |
toString()
Returns a string representation of the receiver, including the session ID, the session time-out and a number of the more important state fields. |
void |
unableToSetNullForKey(String key)
Invoked from takeValueForKey when it is given a null value
for a scalar property (such as an int or a float ). |
void |
validateEventsLogin(String password,
String username)
Validates the username and password used to access the WOEvents* pages. |
void |
validateStatisticsLogin(String password,
String username)
Validates the username and password used to access the WOStats page. |
void |
validationFailedWithException(Throwable t,
Object value,
String keyPath,
WOComponent component)
Handle an exception thrown as a result of validation failure. |
Object |
valueForKey(String key)
Retrieves the value of the property named by key . |
Object |
valueForKeyPath(String keyPath)
Retrieves the value of a property of the object at the end of the key path (a key path is a string of the form "key1.key2"). |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String SessionDidCreateNotification
awake
).
The object of the notification is the session instance.public static final String SessionDidRestoreNotification
awake
).
The object of the notification is the session instance.public static final String SessionDidTimeOutNotification
Constructor Detail |
public WOSession()
WOApplication.sessionTimeOut()
seconds. The isDistributionEnabled
flag is set to false
, meaning that each request in the session will be
handled by the same application instance.isDistributionEnabled()
,
setDistributionEnabled(boolean aFlag)
,
WOApplication.sessionTimeOut()
public WOSession(String aSessionID)
aSessionId
and a session time-out
of WOApplication.sessionTimeOut()
seconds. The isDistributionEnabled
flag is set to false
, meaning that each request in the session will be
handled by the same application instance.aSessionID
- the session ID providedisDistributionEnabled()
,
setDistributionEnabled(boolean aFlag)
,
WOApplication.sessionTimeOut()
Method Detail |
public boolean allowedToViewEvents()
false
.
This method returns false
by default.
true
if the session is allowed to view the WOEvents* pagesvalidateEventsLogin(String password, String username)
,
allowedToViewStatistics()
,
validateStatisticsLogin(String password, String username)
public boolean allowedToViewStatistics()
false
.
By default, this method returns false
.
true
if clients are allowed to view session statisticsvalidateStatisticsLogin(String password, String username)
,
allowedToViewEvents()
,
validateEventsLogin(String password, String username)
public void appendToResponse(WOResponse aResponse, WOContext aContext)
appendToResponse
on the WOComponent
that represents the response page. Then it records information about the
current transaction by invoking recordStatisticsForResponse
and
then descriptionForResponse
on the WOStatisticsStore object.Subclasses of WOSession can override this method to replace or supplement the default behavior with custom logic. Note This method is not called during a direct action request-response loop.
aResponse
- the WOResponseaContext
- the WOContext of the transactioninvokeAction(WORequest aRequest, WOContext aContext)
,
takeValuesFromRequest(WORequest aRequest, WOContext aContext)
,
WOStatisticsStore.recordStatisticsForResponse(WOResponse aResponse , WOContext aContext)
,
WOStatisticsStore.descriptionForResponse(WOResponse aResponse , WOContext aContext)
public void awake()
The default implementation does nothing.
sleep()
public static boolean canAccessFieldsDirectly()
true
in all cases, indicating that key-value coding is
allowed to access fields in this object if an appropriate accessor method isn't present.true
in all casespublic Object clone()
clone
in class Object
public WOContext context()
WOContext
public static void debugString(String string)
string
- String to be loggedpublic EOEditingContext defaultEditingContext()
There is only one unique editing context instance per session.
The instance's parent object store is initialized to the default parent object store.
setDefaultEditingContext(EOEditingContext editingContext)
public String domainForIDCookies()
adaptorPrefix
and the application name, including
the .woa
extension.storesIDsInCookies()
,
setStoresIDsInCookies(boolean aFlag)
,
WORequest.adaptorPrefix()
public NSTimestamp expirationDateForIDCookies()
null
in all casespublic Object handleQueryWithUnboundKey(String key)
NSKeyValueCoding.ErrorHandling
valueForKey
when it finds no property binding
for key
. The default implementation
throws an NSKeyValueCoding.UnknownKeyException,
with the target object(TargetObjectUserInfoKey)
and
key(UnknownUserInfokey)
in the user info. An NSKeyValueCoding.ErrorHandling class can override this
method to handle the query in some other way. The method can return a value,
in which case that value is returned by the corresponding
valueForKey
invocation.handleQueryWithUnboundKey
in interface NSKeyValueCoding.ErrorHandling
com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
key
- the property name which generated this errornull
that the custom implementation desires. The default implementation throws an exception instead.NSKeyValueCoding.UnknownKeyException
- when it finds no
property binding for keyNSKeyValueCoding.valueForKey(java.lang.String)
,
NSKeyValueCoding.UnknownKeyException
,
NSKeyValueCoding.DefaultImplementation
public void handleTakeValueForUnboundKey(Object value, String key)
NSKeyValueCoding.ErrorHandling
takeValueForKey
when it finds no property binding
for key
. The default implementation
throws an NSKeyValueCoding.UnknownKeyException, with the
target object(TargetObjectUserInfoKey)
and key(UnknownUserInfoKey)
in the user info dictionary of the exception. An NSKeyValueCoding.ErrorHandling class can override this
method to handle the error in some other way.handleTakeValueForUnboundKey
in interface NSKeyValueCoding.ErrorHandling
com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
value
- the new value which could not be setkey
- the name of the property which generated this errorNSKeyValueCoding.UnknownKeyException
- when it finds
no property binding for keyNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCoding.UnknownKeyException
,
NSKeyValueCoding.DefaultImplementation
public WOActionResults invokeAction(WORequest aRequest, WOContext aContext)
invokeAction
method is propagated through the objects of an application, most
importantly, the WOElement objects of the request page. The dynamic
element on which the user has acted -- by, for example, clicking a
button -- responds by triggering the method in the request WOComponent
that is bound to the action.
The default behavior of WOSession is to invoke invokeAction
on the WOComponent object that represents the request.
Subclasses of WOSession can override this method to replace or supplement the default behavior with custom logic.
aRequest
- the WORequest being processedaContext
- the WOContext context in which the request is being processedappendToResponse(WOResponse aResponse, WOContext aContext)
,
takeValuesFromRequest(WORequest aRequest, WOContext aContext)
public boolean isDistributionEnabled()
false
by default, since the default WOSessionStore
does not support distributed sessions.
When false
, generated URLs include the application instance number.
The web server adaptor then uses this number to route the request to a specific
application instance.
When true
, generated URLs do not contain the application
instance number, and the transactions in a session are distributed among
application instances based on whichever load balancing algorithm is in
use.
false
if generated URLs should include the application instance
number, true
otherwisesetDistributionEnabled(boolean aFlag)
public boolean isTerminating()
true
,
the session will terminate after the conclusion of the current request-response loop.true
if the receiver will terminate at the end of the current
request-response loop, false
otherwiseterminate()
public NSArray languages()
setLanguages
.setLanguages(NSArray languages)
public static void logString(String string)
string
- String to be loggedpublic Object objectForKey(String aKey)
aKey
- the key under which the object is storedsetObjectForKey(Object anObject, String aKey)
,
removeObjectForKey(String aKey)
public void removeObjectForKey(String aKey)
aKey
- String key under which the Object is storedobjectForKey(String aKey)
,
setObjectForKey(Object anObject, String aKey)
public WOComponent restorePageForContextID(String aContextID)
awake
method is called and it is
returned; otherwise, null
is returned.
The key to the stored instance is its contextID
, which derives from the
transaction's WOContext or WORequest objects.
Note: If you wish to use this method to restore a page generated
by WOLongResponse, you must be sure to use the sessionID
retrieved
during the WOLongResponse's appendToResponse
.
aContextID
- the key to the stored instancenull
if restoration is impossiblesavePage(WOComponent aPage)
,
savePageInPermanentCache(WOComponent aPageComponent)
,
sessionID()
,
WOContext.contextID()
public void savePage(WOComponent aPage)
aPage
in the session's page cache.
Invoked automatically if the WOApplication subclass' pageCacheSize
is non-zero.
The context ID
for the current transaction should be used as the key for retrieving
this instance from the cache using restorePageForContextID
.aPage
- the page instancerestorePageForContextID(String aContextID)
,
savePageInPermanentCache(WOComponent aPageComponent)
,
WOContext.contextID()
public void savePageInPermanentCache(WOComponent aPageComponent)
aPageComponent
into the permanent page cache. The permanent
page cache is designed to hold components which are frequently accessed.
This is useful when you are using frames, since the number of component instances
active in a frameset would dramatically reduce the size of the standard page cache.
Objects can fall out of the permanent page cache if the permanent page cache's
size is exceeded.
Note that the best place to call this method is in your component class' constructor to
avoid calling it multiple times for the same object.
The latest place this method should ever invoke is the beginning of the component's
appendToResponse
method.aPageComponent
- any WOComponentrestorePageForContextID(java.lang.String)
,
savePage(com.webobjects.appserver.WOComponent)
,
WOApplication.permanentPageCacheSize()
,
WOApplication.setPermanentPageCacheSize(int anUnsigned)
,
WOComponent.appendToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)
public String sessionID()
sessionID
. This ID may be stored in the URL, or in a cookie. If
it is in the URL, it will apear after the request handler key.
The sessionID
does not change during the life of the session.
Unless the receiver is a copy of another session, or was created with a specified
sessionID
, the sessionID
will be a unique randomly generated String.
public void setDefaultEditingContext(EOEditingContext editingContext)
defaultEditingContext
.
This can be used to set an editing context initialized with a different
parent object store than the default. This is useful when, for instance,
each session needs its own login to the database.
Once a default editing context has been established, setDefaultEditingContext
may not be called again. Therefore, to provide your own default editing context,
setDefaultEditingContext
must be called before ever calling
defaultEditingContext
since that will lazily establish an
editing context.
editingContext
- the EOEditingContext to be used as the defaultdefaultEditingContext()
public void setDistributionEnabled(boolean aFlag)
When false
, generated URLs include the application instance number.
The web server adaptor then uses this number to route the request to a specific
application instance.
When true
, generated URLs do not contain the application
instance number, and the transactions in a session are distributed among
application instances based on whichever load balancing algorithm is in
use.
Returns false
aFlag
- false
if generated URLs should include the application instance
number, true
otherwiseisDistributionEnabled()
public void setLanguages(NSArray someLanguages)
.lproj
directories for localized
strings, images, and component definitions.someLanguages
- the array of languages for the applicationlanguages()
public void setObjectForKey(Object anObject, String aKey)
element ID
. For a specific component
instance, such a prefix should remain unique and invariant within
a session.anObject
- Object to be stored in the current sessionaKey
- String key under which to store the objectobjectForKey(String aKey)
,
removeObjectForKey(String aKey)
public void setStoresIDsInCookies(boolean aFlag)
If aFlag
is true
, two cookies are created to store session
information: a session ID cookie with the name WORequest.SessionIDKey
, and an instance
ID cookie with the name WORequest.InstanceKey
.
By default, this mechanism is disabled.
aFlag
- true
if the session ID should be stored using cookies, false
otherwisestoresIDsInCookies()
,
storesIDsInURLs()
,
setStoresIDsInURLs(boolean aFlag)
public void setStoresIDsInURLs(boolean aFlag)
By default, this mechanism is enabled.
aFlag
- true
if the session ID should be stored in the URL,
false
otherwisestoresIDsInCookies()
,
setStoresIDsInCookies(boolean aFlag)
,
storesIDsInURLs()
public void setTimeOut(double aTimeInterval)
By default, the session time-out is set to the value returned by WOApplication.sessionTimeOut()
.
aTimeInterval
- the number of seconds the session should remain idle before it times outtimeOut()
,
WOApplication.sessionTimeOut()
public void sleep()
The default WOSession implementation does nothing.
awake()
public NSArray statistics()
descriptionForResponse
to its WOComponent object. By
default, this returns the component's name. If the application keeps
a CLFF log file, this list is recorded in the log file when the
session terminates.appendToResponse(WOResponse aResponse, WOContext aContext)
,
WOComponent.descriptionForResponse(WOResponse aResponse, WOContext aContext)
public boolean storesIDsInCookies()
If true
, two cookies are created to store session information:
a session ID cookie with the name WORequest.SessionIDKey
, and an instance ID
cookie with the name WORequest.InstanceKey
.
Returns false
by default.
true
if the session ID should be stored using cookies, false
otherwisesetStoresIDsInCookies(boolean aFlag)
,
storesIDsInURLs()
,
setStoresIDsInURLs(boolean aFlag)
public boolean storesIDsInURLs()
Returns true
by default.
true
if the session ID should be stored in the URL,
false
otherwisestoresIDsInCookies()
,
setStoresIDsInCookies(boolean aFlag)
,
setStoresIDsInURLs(boolean aFlag)
public void takeValueForKey(Object value, String key)
NSKeyValueCoding
key
to value
.The default implementation provided by NSKeyValueCoding.DefaultImplementation works as follows:
set
Key, and invokes it if there is one._set
Key,
and invokes it if there is one.canAccessFieldsDirectly
returns true
, searches for a
field based on key
and sets its value directly.
For the key "lastName", this would be _lastName
, _isLastName
, lastName
, or isLastName
.
value
argument is not compatible with the underlying field or method parameter, the default implementation will make an effort to
convert between different Java numeric types (Integer, Double, BigDecimal, etc) as well as between Boolean and Number (true = 1, false = 0). If any other
conversion would be necessary, an exception is thrown.
handleTakeValueForUnboundKey
if the object implements NSKeyValueCoding.ErrorHandling or throws
NSKeyValueCoding.UnknownKeyException if the object does not.Note: : The default implementations have significant performance optimizations. To benefit from them, implement NSKeyValueCoding on a custom class as shown above by using the methods in NSKeyValueCoding. DefaultImplementation, or if your class inherits from an WebObjects class that implements NSKeyValueCoding, do not override the inherited implementation. Using a custom implementation incurs significant performance penalties.
takeValueForKey
in interface NSKeyValueCoding
com.webobjects.foundation.NSKeyValueCoding
value
- the new value for the property named by key
key
- identifies the property to changeNSKeyValueCoding.UnknownKeyException
- if key
cannot be found on the object this method was invoked upon.NSKeyValueCoding.NullValue
,
NSKeyValueCoding.valueForKey(java.lang.String)
,
NSKeyValueCoding.DefaultImplementation
,
NSKeyValueCoding.ErrorHandling
,
NSKeyValueCoding.ErrorHandling.handleTakeValueForUnboundKey(java.lang.Object, java.lang.String)
public void takeValueForKeyPath(Object value, String keyPath)
NSKeyValueCodingAdditions
keyPath
to value
. A key path has the form relationship.property
(with one or more relationships); for example "movieRole.roleName"
or "movieRole.talent.lastName". The default implementation of
this method (provided by NSKeyValueCodingAdditions.DefaultImplementation)
gets the destination object for each relationship using valueForKey
,
and sends the final object a takeValueForKey
message with value
and property
.takeValueForKeyPath
in interface NSKeyValueCodingAdditions
com.webobjects.foundation.NSKeyValueCodingAdditions
value
- the property identified by keyPath
is set to thiskeyPath
- identifies the property of an objectNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCodingAdditions.valueForKeyPath(java.lang.String)
,
NSKeyValueCodingAdditions.DefaultImplementation
public void takeValuesFromRequest(WORequest aRequest, WOContext aContext)
The default behavior of WOSession is to invoke takeValuesFromRequest
on the WOComponent object that represents the request.
Subclasses of WOSession can override this method to replace or supplement the default behavior with custom logic.
aRequest
- the request to be processedaContext
- the current context of the transactionappendToResponse(WOResponse aResponse, WOContext aContext)
,
invokeAction(WORequest aRequest, WOContext aContext)
public void terminate()
isTerminating()
public double timeOut()
setTimeOut(double aTimeInterval)
public int timeOutForIDCookies()
-1
in all casespublic long timeOutMillis()
public String toString()
toString
in class Object
public void unableToSetNullForKey(String key)
NSKeyValueCoding.ErrorHandling
takeValueForKey
when it is given a null
value
for a scalar property (such as an int
or a float
).
The default implementation throws an IllegalArgumentException
.
You might want to implement the method (or override the inherited
implementation) to handle the request in some other way, such as by
substituting new Integer(0)
or a sentinel value and invoking takeValueForKey
again.unableToSetNullForKey
in interface NSKeyValueCoding.ErrorHandling
com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
key
- the name of the property which generated this errorIllegalArgumentException
- when it is given a null value
for a scalar propertyNSKeyValueCoding.takeValueForKey(Object value, String key)
,
NSKeyValueCoding.DefaultImplementation
public void validateEventsLogin(String password, String username)
WOEventsPassword
property. By default, the username is ignored.
Subclasses of WOSession can override this method to provide application specific login behavior.
password
- input passwordusername
- input user's nameallowedToViewEvents()
,
allowedToViewStatistics()
,
validateStatisticsLogin(String password, String username)
public void validateStatisticsLogin(String password, String username)
WOStatisticsPassword
property.By default, the username is ignored.
Subclasses of WOSession can override this method to provide application specific login behavior.
password
- input passwordusername
- input user's nameallowedToViewStatistics()
,
allowedToViewEvents()
,
validateEventsLogin(String password, String username)
public void validationFailedWithException(Throwable t, Object value, String keyPath, WOComponent component)
By default, this method invokes your application class' validationFailedWithException
method.
Subclasses of WOSession can override this method to provide application specific behavior.
t
- the exception that was thrownvalue
- the value that was being setkeyPath
- the derived path that was being accessedcomponent
- the component that was being usedWOApplication.validationFailedWithException(Throwable t, Object value, String keyPath, WOComponent component, WOSession session)
public Object valueForKey(String key)
NSKeyValueCoding
key
.The default implementation provided by NSKeyValueCoding.DefaultImplementation works as follows:
key
. For
example, with a key of "lastName", the method looks for a method named
getLastName, lastName, or isLastName.canAccessFieldsDirectly
returns true
, the method searches
for a field based on key
and returns its value
directly. For the key "lastName", this would be _lastName, _isLastName, lastName, or isLastName.Note: The default implementations have significant performance optimizations. To benefit from them, implement NSKeyValueCoding on a custom class as shown above by using the methods in NSKeyValueCoding.DefaultImplementation, or if your class inherits from an WebObjects class that implements NSKeyValueCoding, do not override the inherited implementation. Using a custom implementation incurs significant performance penalties.
valueForKey
in interface NSKeyValueCoding
com.webobjects.foundation.NSKeyValueCoding
key
- identifies the property to retrievekey
. Depending on the object you invoke this method upon, null
may be replaced with NullValue
NSKeyValueCoding.UnknownKeyException
- if key
cannot be found on the object this method was invoked upon.NSKeyValueCoding.NullValue
,
NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCoding.DefaultImplementation
,
NSKeyValueCoding.ErrorHandling
,
NSKeyValueCoding.ErrorHandling.handleQueryWithUnboundKey(java.lang.String)
public Object valueForKeyPath(String keyPath)
NSKeyValueCodingAdditions
valueForKey
,
and returns the result of a valueForKey
message to the final
object.valueForKeyPath
in interface NSKeyValueCodingAdditions
com.webobjects.foundation.NSKeyValueCodingAdditions
keyPath
- the keypath to evaluatekeyPath
NSKeyValueCoding.valueForKey(java.lang.String)
,
NSKeyValueCodingAdditions.takeValueForKeyPath(java.lang.Object, java.lang.String)
,
NSKeyValueCodingAdditions.DefaultImplementation
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |