org.apache.axis.handlers
Class SimpleSessionHandler
java.lang.Object
|
+--org.apache.axis.handlers.BasicHandler
|
+--org.apache.axis.handlers.SimpleSessionHandler
- All Implemented Interfaces:
- Handler, java.io.Serializable
- public class SimpleSessionHandler
- extends BasicHandler
This handler uses SOAP headers to do simple session management.
Essentially, you install it on both the request and response chains of
your service, on both the client and the server side.
ON THE SERVER:
- The REQUEST is checked for a session ID header. If present, we
look up the correct SimpleSession. If not, we create a new session.
In either case, we install the session into the MessageContext, and
put its ID in the SESSION_ID property.
- The RESPONSE gets a session ID header tacked on, assuming we found a
SESSION_ID property in the MessageContext.
ON THE CLIENT:
- The RESPONSE messages are checked for session ID headers. If present,
we pull the ID out and insert it into an option in the AxisClient.
This works because a given Call object is associated with a single
AxisClient. However, we might want to find a way to put it into the
Call object itself, which would make a little more sense. This would
mean being able to get to the Call from the MC, i.e. adding a getCall()
API (which would only work on the client side)....
- When REQUESTS are generated, we look to see if an ID option is present
in the AxisClient associated with the MessageContext. If so, we
insert a session ID header with the appropriate ID.
SimpleSessions are "reaped" periodically via a very simplistic
mechanism. Each time the handler is invoke()d we check to see if more
than reapPeriodicity milliseconds have elapsed since the last
reap. If so, we walk the collection of active Sessions, and for each
one, if it hasn't been "touched" (i.e. had a getProperty() or setProperty()
performed) in longer than its timeout, we remove it from the collection.
- Author:
- Glen Daniels (gdaniels@macromedia.com)
- See Also:
- Serialized Form
Methods inherited from class org.apache.axis.handlers.BasicHandler |
canHandleBlock, cleanup, generateWSDL, getDeploymentData, getName, getOption, getOptions, getUnderstoodHeaders, init, initHashtable, onFault, setName, setOption, setOptionDefault, setOptions, setOptionsLockable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
SESSION_ID
public static final java.lang.String SESSION_ID
SESSION_NS
public static final java.lang.String SESSION_NS
SESSION_LOCALPART
public static final java.lang.String SESSION_LOCALPART
sessionHeaderName
public static final QName sessionHeaderName
SimpleSessionHandler
public SimpleSessionHandler()
invoke
public void invoke(MessageContext context)
throws AxisFault
- Process a MessageContext.
- Overrides:
invoke
in class BasicHandler
doClient
public void doClient(MessageContext context)
throws AxisFault
- Client side of processing.
doServer
public void doServer(MessageContext context)
throws AxisFault
- Server side of processing.
setReapPeriodicity
public void setReapPeriodicity(long reapTime)
- Set the reaper periodicity in SECONDS
Convenience method for testing.
!!! TODO: Should be able to set this via options on the Handler
or perhaps the engine.
setDefaultSessionTimeout
public void setDefaultSessionTimeout(int defaultSessionTimeout)
- Set the default session timeout in SECONDS
Again, for testing.
Copyright © 2003 Apache Web Services Project. All Rights Reserved.