Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.handlers
Class SimpleSessionHandler  view SimpleSessionHandler download SimpleSessionHandler.java

java.lang.Object
  extended byorg.apache.axis.handlers.BasicHandler
      extended byorg.apache.axis.handlers.SimpleSessionHandler
All Implemented Interfaces:
org.apache.axis.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:

ON THE CLIENT:

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.


Field Summary
private  java.util.Hashtable activeSessions
           
private  int defaultSessionTimeout
           
private  long lastReapTime
           
protected static org.apache.commons.logging.Log log
           
private  long reapPeriodicity
           
static java.lang.String SESSION_ID
           
static java.lang.String SESSION_LOCALPART
           
static java.lang.String SESSION_NS
           
static javax.xml.namespace.QName sessionHeaderName
           
 
Fields inherited from class org.apache.axis.handlers.BasicHandler
makeLockable, name, options
 
Constructor Summary
SimpleSessionHandler()
           
 
Method Summary
 void doClient(org.apache.axis.MessageContext context)
          Client side of processing.
 void doServer(org.apache.axis.MessageContext context)
          Server side of processing.
private  java.lang.Long getNewSession()
          Generate a new session, register it, and return its ID.
 void invoke(org.apache.axis.MessageContext context)
          Process a MessageContext.
 void setDefaultSessionTimeout(int defaultSessionTimeout)
          Set the default session timeout in SECONDS Again, for testing.
 void setReapPeriodicity(long reapTime)
          Set the reaper periodicity in SECONDS Convenience method for testing.
 
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
 

Field Detail

log

protected static org.apache.commons.logging.Log log

SESSION_ID

public static final java.lang.String SESSION_ID
See Also:
Constant Field Values

SESSION_NS

public static final java.lang.String SESSION_NS
See Also:
Constant Field Values

SESSION_LOCALPART

public static final java.lang.String SESSION_LOCALPART
See Also:
Constant Field Values

sessionHeaderName

public static final javax.xml.namespace.QName sessionHeaderName

activeSessions

private java.util.Hashtable activeSessions

reapPeriodicity

private long reapPeriodicity

lastReapTime

private long lastReapTime

defaultSessionTimeout

private int defaultSessionTimeout
Constructor Detail

SimpleSessionHandler

public SimpleSessionHandler()
Method Detail

invoke

public void invoke(org.apache.axis.MessageContext context)
            throws org.apache.axis.AxisFault
Process a MessageContext.


doClient

public void doClient(org.apache.axis.MessageContext context)
              throws org.apache.axis.AxisFault
Client side of processing.


doServer

public void doServer(org.apache.axis.MessageContext context)
              throws org.apache.axis.AxisFault
Server side of processing.


getNewSession

private java.lang.Long getNewSession()
Generate a new session, register it, and return its ID.


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.