Class HttpMessageContext

java.lang.Object
com.levigo.jadice.web.transport.server.networking.HttpMessageContext
All Implemented Interfaces:
MessageContext

public class HttpMessageContext extends Object implements MessageContext
This extends the MessageContext by carrying the HttpServletRequest of the client.
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpMessageContext(String clientID, jakarta.servlet.http.HttpServletRequest request)
    Constructs a message context, that interfaces a Client, identified by its id, with the corresponding HttpServletRequest.
    HttpMessageContext(String clientID, jakarta.servlet.http.HttpServletRequest request, boolean alwaysCreateHttpSession)
    Constructs a message context, that interfaces a Client, identified by its id, with the corresponding HttpServletRequest.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the client id of the client which did send the message associated with this message context.
    jakarta.servlet.http.HttpSession
    Returns the HttpSession of the message associated with this message context.
    Returns the query string contained in the message for this context.
    jakarta.servlet.http.HttpServletRequest
    Gets the HttpServletRequest of the HTTP message.
    Returns the URI requested by the message for this context from the protocol up to the query string.
    Returns the Principal identifying the user sending the message.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpMessageContext

      public HttpMessageContext(String clientID, jakarta.servlet.http.HttpServletRequest request)
      Constructs a message context, that interfaces a Client, identified by its id, with the corresponding HttpServletRequest.
      Parameters:
      clientID - the id of the client
      request - the request of the client
    • HttpMessageContext

      public HttpMessageContext(String clientID, jakarta.servlet.http.HttpServletRequest request, boolean alwaysCreateHttpSession)
      Constructs a message context, that interfaces a Client, identified by its id, with the corresponding HttpServletRequest.
      Parameters:
      clientID - the id of the client
      request - the request of the client
      alwaysCreateHttpSession - set this to false if you do not want to enforece the creation of a http-session
  • Method Details

    • getRequest

      public jakarta.servlet.http.HttpServletRequest getRequest()
      Gets the HttpServletRequest of the HTTP message.
      Returns:
      the HttpServletRequest of the HTTP message.
    • getUserPrincipal

      public Principal getUserPrincipal()
      Description copied from interface: MessageContext
      Returns the Principal identifying the user sending the message.
      Specified by:
      getUserPrincipal in interface MessageContext
      Returns:
      the user Principal
    • getRequestURI

      public String getRequestURI()
      Description copied from interface: MessageContext
      Returns the URI requested by the message for this context from the protocol up to the query string.

      Example:

      • https://somepage.com/somesite?key=value
      • RequestURI: somepage.com/somesite
      Specified by:
      getRequestURI in interface MessageContext
      Returns:
      the requested URI
    • getQueryString

      public String getQueryString()
      Description copied from interface: MessageContext
      Returns the query string contained in the message for this context.

      Example:

      • https://somepage.com/somesite?key=value
      • QueryString: key=value
      Specified by:
      getQueryString in interface MessageContext
      Returns:
      the query string
    • getClientID

      public String getClientID()
      Description copied from interface: MessageContext
      Returns the client id of the client which did send the message associated with this message context.
      Specified by:
      getClientID in interface MessageContext
      Returns:
      the client id
    • getHTTPSession

      public jakarta.servlet.http.HttpSession getHTTPSession()
      Description copied from interface: MessageContext
      Returns the HttpSession of the message associated with this message context.
      Specified by:
      getHTTPSession in interface MessageContext
      Returns:
      the HttpSession