Class AbstractBayeuxContext

java.lang.Object
org.cometd.server.websocket.common.AbstractBayeuxContext
All Implemented Interfaces:
BayeuxContext

public abstract class AbstractBayeuxContext extends Object implements BayeuxContext
  • Constructor Details

  • Method Details

    • getURL

      public String getURL()
      Specified by:
      getURL in interface BayeuxContext
      Returns:
      the full request URI complete with query string if present
    • getHeader

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

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

      public String getParameter(String name)
      Specified by:
      getParameter in interface BayeuxContext
      Parameters:
      name - the name of the query parameter
      Returns:
      the value of the query parameter, or null if no such parameter
    • getParameterValues

      public List<String> getParameterValues(String name)
      Specified by:
      getParameterValues in interface BayeuxContext
      Parameters:
      name - the name of the query parameter
      Returns:
      the values of the query parameter, or null if no such parameter
    • getUserPrincipal

      public Principal getUserPrincipal()
      Specified by:
      getUserPrincipal in interface BayeuxContext
      Returns:
      the user Principal (if any)
    • isUserInRole

      public boolean isUserInRole(String role)
      Specified by:
      isUserInRole in interface BayeuxContext
      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

      public SocketAddress getRemoteAddress()
      Specified by:
      getRemoteAddress in interface BayeuxContext
      Returns:
      the remote socket address
    • getLocalAddress

      public SocketAddress getLocalAddress()
      Specified by:
      getLocalAddress in interface BayeuxContext
      Returns:
      the local socket address
    • getLocales

      public List<Locale> getLocales()
      Specified by:
      getLocales in interface BayeuxContext
      Returns:
      the request Locales, in order of preference, or the default server Locale if the request does not specify locales
    • getCookie

      public String getCookie(String name)
      Specified by:
      getCookie in interface BayeuxContext
      Parameters:
      name - the name of the cookie
      Returns:
      the value of the cookie value, or null if no such cookie
    • getContextAttribute

      public Object getContextAttribute(String name)
      Specified by:
      getContextAttribute in interface BayeuxContext
      Parameters:
      name - the context attribute name
      Returns:
      the context attribute value, or null if no such attribute
    • getRequestAttribute

      public Object getRequestAttribute(String name)
      Specified by:
      getRequestAttribute in interface BayeuxContext
      Parameters:
      name - the request attribute name
      Returns:
      the request attribute value, or null if no such attribute
    • getSessionId

      public String getSessionId()
      Description copied from interface: BayeuxContext

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

      Specified by:
      getSessionId in interface BayeuxContext
      Returns:
      the HTTP session id, or null if there is no HTTP session
    • getSessionAttribute

      public Object getSessionAttribute(String name)
      Description copied from interface: BayeuxContext

      Returns an HTTP session attribute value.

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

      Specified by:
      getSessionAttribute in interface BayeuxContext
      Parameters:
      name - the HTTP session attribute name
      Returns:
      the HTTP session attribute value, or null if no such attribute
    • getContextPath

      public String getContextPath()
      Specified by:
      getContextPath in interface BayeuxContext
      Returns:
      the web application context path
    • getProtocol

      public String getProtocol()
      Specified by:
      getProtocol in interface BayeuxContext
      Returns:
      a string containing the protocol name and version number
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface BayeuxContext
      Returns:
      whether the request was made over a secure transport