Class 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.
    • 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