org.apache.synapse.endpoints.dispatch
Class HttpSessionDispatcher

java.lang.Object
  extended by org.apache.synapse.endpoints.dispatch.AbstractDispatcher
      extended by org.apache.synapse.endpoints.dispatch.HttpSessionDispatcher
All Implemented Interfaces:
Dispatcher

public class HttpSessionDispatcher
extends AbstractDispatcher

Dispatches sessions based on HTTP cookies. Session is initiated by the server in the first response when it sends "Set-Cookie" HTTP header with the session ID. For all successive messages client should send "Cookie" HTTP header with session ID send by the server.


Field Summary
static String HOSTS
           
 
Fields inherited from class org.apache.synapse.endpoints.dispatch.AbstractDispatcher
log
 
Constructor Summary
HttpSessionDispatcher()
           
 
Method Summary
protected  List<String> extractSessionIDs(MessageContext synCtx, String key)
           
 SessionInformation getSession(MessageContext synCtx)
          Check if "Cookie" HTTP header is available.
 boolean isServerInitiatedSession()
          HTTP sessions are initiated by the server.
 void removeSessionID(MessageContext syCtx)
          Remove the session Id - To clear out session information from current message
 void unbind(MessageContext synCtx)
          Removes the session belonging to the given message context.
 void updateSession(MessageContext synCtx)
          Searches for "Set-Cookie" HTTP header in the message context.
 
Methods inherited from class org.apache.synapse.endpoints.dispatch.AbstractDispatcher
extractSessionID, extractSessionID, getEndpoints, removeSessionID, removeSessionID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOSTS

public static final String HOSTS
See Also:
Constant Field Values
Constructor Detail

HttpSessionDispatcher

public HttpSessionDispatcher()
Method Detail

getSession

public SessionInformation getSession(MessageContext synCtx)
Check if "Cookie" HTTP header is available. If so, check if that cookie is in the session map. If cookie is available, there is a session for this cookie. return the (server) endpoint for that session.

Parameters:
synCtx - MessageContext possibly containing a "Cookie" HTTP header.
Returns:
Endpoint Server endpoint for the given HTTP session.

updateSession

public void updateSession(MessageContext synCtx)
Searches for "Set-Cookie" HTTP header in the message context. If found and that given session ID is not already in the session map update the session map by mapping the cookie to the endpoint.

Parameters:
synCtx - MessageContext possibly containing the "Set-Cookie" HTTP header.

unbind

public void unbind(MessageContext synCtx)
Description copied from interface: Dispatcher
Removes the session belonging to the given message context.

Parameters:
synCtx - MessageContext containing an session ID.

isServerInitiatedSession

public boolean isServerInitiatedSession()
HTTP sessions are initiated by the server.

Returns:
true

removeSessionID

public void removeSessionID(MessageContext syCtx)
Description copied from interface: Dispatcher
Remove the session Id - To clear out session information from current message

Parameters:
syCtx - MessageContext containing an session ID

extractSessionIDs

protected List<String> extractSessionIDs(MessageContext synCtx,
                                         String key)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.