Class HttpSessionDispatcher
- java.lang.Object
-
- org.apache.synapse.endpoints.dispatch.AbstractDispatcher
-
- 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
Fields Modifier and Type Field Description static String
HOSTS
-
Fields inherited from class org.apache.synapse.endpoints.dispatch.AbstractDispatcher
log
-
-
Constructor Summary
Constructors Constructor Description HttpSessionDispatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 messagevoid
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
extractSessionCookie, extractSessionID, extractSessionID, getEndpoints, removeSessionID, removeSessionID
-
-
-
-
Field Detail
-
HOSTS
public static final String HOSTS
- See Also:
- Constant Field Values
-
-
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)
-
-