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 Link icon

    • getUserPrincipal Link icon

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

      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 Link icon

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

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

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

      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 Link icon

      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 Link icon

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

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

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

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

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