Interface BayeuxContext

All Known Implementing Classes:
AbstractBayeuxContext

public interface BayeuxContext

The Bayeux Context provides information about the current context of a Bayeux message.

This information may be from an associated HTTP request, or from a HTTP request originally used to establish the connection to the server (for example in a WebSocket upgrade).

  • Method Details

    • getUserPrincipal

      Principal getUserPrincipal()
      Returns:
      the user Principal (if any)
    • isUserInRole

      boolean isUserInRole(String role)
      Parameters:
      role - the role to check whether the user belongs to
      Returns:
      true if there is a known user and they are in the given role
    • getRemoteAddress

      SocketAddress getRemoteAddress()
      Returns:
      the remote socket address
    • getLocalAddress

      SocketAddress getLocalAddress()
      Returns:
      the local socket address
    • getHeader

      String getHeader(String name)
      Parameters:
      name - the name of the request header
      Returns:
      the value of the header, or null if there is no such header
    • getHeaderValues

      List<String> getHeaderValues(String name)
      Parameters:
      name - the name of the request header
      Returns:
      the values of the header, or null if no such header
    • getParameter

      String getParameter(String name)
      Parameters:
      name - the name of the query parameter
      Returns:
      the value of the query parameter, or null if no such parameter
    • getParameterValues

      List<String> getParameterValues(String name)
      Parameters:
      name - the name of the query parameter
      Returns:
      the values of the query parameter, or null if no such parameter
    • getCookie

      String getCookie(String name)
      Parameters:
      name - the name of the cookie
      Returns:
      the value of the cookie value, or null if no such cookie
    • getContextAttribute

      Object getContextAttribute(String name)
      Parameters:
      name - the context attribute name
      Returns:
      the context attribute value, or null if no such attribute
    • getRequestAttribute

      Object getRequestAttribute(String name)
      Parameters:
      name - the request attribute name
      Returns:
      the request attribute value, or null if no such attribute
    • getSessionId

      String getSessionId()

      Returns the HTTP session id, or null if there is no HTTP session.

      Returns:
      the HTTP session id, or null if there is no HTTP session
    • getSessionAttribute

      Object getSessionAttribute(String name)

      Returns an HTTP session attribute value.

      Session.getAttribute(String) should be used to retrieve attribute values in session scope.

      Parameters:
      name - the HTTP session attribute name
      Returns:
      the HTTP session attribute value, or null if no such attribute
    • getContextPath

      String getContextPath()
      Returns:
      the web application context path
    • getURL

      String getURL()
      Returns:
      the full request URI complete with query string if present
    • getLocales

      List<Locale> getLocales()
      Returns:
      the request Locales, in order of preference, or the default server Locale if the request does not specify locales
    • getProtocol

      String getProtocol()
      Returns:
      a string containing the protocol name and version number
    • isSecure

      boolean isSecure()
      Returns:
      whether the request was made over a secure transport