Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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@apache.org)
See Also:
  Serialized Form

Field Summary
`protected static org.apache.commons.logging.Log` | `log`
`static java.lang.String` | `SESSION_ID`
`static java.lang.String` | `SESSION_LOCALPART`
`static java.lang.String` | `SESSION_NS`
`static QName` | `sessionHeaderName`

Fields inherited from class org.apache.axis.handlers.BasicHandler
`makeLockable, name, options`

Constructor Summary
`SimpleSessionHandler()`

Method Summary
`void` | `doClient(MessageContext context)` Client side of processing.
`void` | `doServer(MessageContext context)` Server side of processing.
`void` | `invoke(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 QName sessionHeaderName

Constructor Detail

### SimpleSessionHandler

    public SimpleSessionHandler()

Method Detail

### invoke

    public void invoke(MessageContext context)
                throws AxisFault

  Process a MessageContext.

  Parameters:
    `context` - the `MessageContext` to process with this `Handler`.
  Throws:
    `AxisFault` - if the handler encounters an error

### doClient

    public void doClient(MessageContext context)
                  throws AxisFault

  Client side of processing.

  Throws:
    `AxisFault`

### doServer

    public void doServer(MessageContext context)
                  throws AxisFault

  Server side of processing.

  Throws:
    `AxisFault`

### 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 Apache Web Services Project. All Rights Reserved.