Class AbstractBayeuxContext

  • All Implemented Interfaces:
    BayeuxContext

    public abstract class AbstractBayeuxContext
    extends java.lang.Object
    implements BayeuxContext
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractBayeuxContext​(javax.servlet.ServletContext context, java.lang.String uri, java.lang.String query, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, java.util.Map<java.lang.String,java.util.List<java.lang.String>> parameters, java.security.Principal principal, javax.servlet.http.HttpSession session, java.net.InetSocketAddress local, java.net.InetSocketAddress remote, java.util.List<java.util.Locale> locales, java.lang.String protocol, boolean secure)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getContextAttribute​(java.lang.String name)
      Access the ServletContext (if any) attributes.
      java.lang.String getContextInitParameter​(java.lang.String name)
      Access the ServletContext (if any) init parameter.
      java.lang.String getContextPath()  
      java.lang.String getCookie​(java.lang.String name)
      Get a transport cookie.
      java.lang.String getHeader​(java.lang.String name)
      Get a transport header.
      java.util.List<java.lang.String> getHeaderValues​(java.lang.String name)
      Get a multi valued transport header.
      java.lang.Object getHttpSessionAttribute​(java.lang.String name)
      Access the HTTP Session (if any) attributes.
      java.lang.String getHttpSessionId()
      Access the HTTP Session (if any) ID.
      java.net.InetSocketAddress getLocalAddress()  
      java.util.List<java.util.Locale> getLocales()  
      java.lang.String getParameter​(java.lang.String name)
      Get a transport parameter.
      java.util.List<java.lang.String> getParameterValues​(java.lang.String name)
      Get a multi valued transport parameter.
      java.lang.String getProtocol()  
      java.net.InetSocketAddress getRemoteAddress()  
      java.lang.Object getRequestAttribute​(java.lang.String name)
      Access the Request (if any) attributes.
      java.lang.String getURL()  
      java.security.Principal getUserPrincipal()  
      void invalidateHttpSession()
      Invalidate the HTTP Session.
      boolean isSecure()  
      boolean isUserInRole​(java.lang.String role)  
      void setHttpSessionAttribute​(java.lang.String name, java.lang.Object value)
      Access the HTTP Session (if any) attributes.
      • Methods inherited from class java.lang.Object

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

      • AbstractBayeuxContext

        public AbstractBayeuxContext​(javax.servlet.ServletContext context,
                                     java.lang.String uri,
                                     java.lang.String query,
                                     java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
                                     java.util.Map<java.lang.String,java.util.List<java.lang.String>> parameters,
                                     java.security.Principal principal,
                                     javax.servlet.http.HttpSession session,
                                     java.net.InetSocketAddress local,
                                     java.net.InetSocketAddress remote,
                                     java.util.List<java.util.Locale> locales,
                                     java.lang.String protocol,
                                     boolean secure)
    • Method Detail

      • getURL

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

        public java.lang.String getHeader​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Get a transport header.

        Get a header for any current transport mechanism (eg HTTP request). For transports like websocket, the header may be from the initial handshake.

        Specified by:
        getHeader in interface BayeuxContext
        Parameters:
        name - The name of the header
        Returns:
        The header value or null if no current transport mechanism or no such header.
      • getHeaderValues

        public java.util.List<java.lang.String> getHeaderValues​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Get a multi valued transport header.

        Get a header for any current transport mechanism (eg HTTP request). For transports like websocket, the header may be from the initial handshake.

        Specified by:
        getHeaderValues in interface BayeuxContext
        Parameters:
        name - The name of the header
        Returns:
        The header value or null if no current transport mechanism or no such header.
      • getParameter

        public java.lang.String getParameter​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Get a transport parameter.

        Get a parameter for any current transport mechanism (eg HTTP request). For transports like websocket, the parameter may be from the initial handshake.

        Specified by:
        getParameter in interface BayeuxContext
        Parameters:
        name - The name of the parameter
        Returns:
        The parameter value or null if no current transport mechanism or no such parameter.
      • getParameterValues

        public java.util.List<java.lang.String> getParameterValues​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Get a multi valued transport parameter.

        Get a parameter for any current transport mechanism (eg HTTP request). For transports like websocket, the parameter may be from the initial handshake.

        Specified by:
        getParameterValues in interface BayeuxContext
        Parameters:
        name - The name of the parameter
        Returns:
        The parameter value or null if no current transport mechanism or no such parameter.
      • getUserPrincipal

        public java.security.Principal getUserPrincipal()
        Specified by:
        getUserPrincipal in interface BayeuxContext
        Returns:
        The user Principal (if any)
      • isUserInRole

        public boolean isUserInRole​(java.lang.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.
      • getHttpSessionId

        public java.lang.String getHttpSessionId()
        Description copied from interface: BayeuxContext
        Access the HTTP Session (if any) ID. The Session.getId() should be used in preference to the HTTP Session.
        Specified by:
        getHttpSessionId in interface BayeuxContext
        Returns:
        HTTP session ID or null
      • getHttpSessionAttribute

        public java.lang.Object getHttpSessionAttribute​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Access the HTTP Session (if any) attributes. The Session.getAttribute(String) should be used in preference to the HTTP Session.
        Specified by:
        getHttpSessionAttribute in interface BayeuxContext
        Parameters:
        name - the attribute name
        Returns:
        The attribute value
      • setHttpSessionAttribute

        public void setHttpSessionAttribute​(java.lang.String name,
                                            java.lang.Object value)
        Description copied from interface: BayeuxContext
        Access the HTTP Session (if any) attributes. The Session.setAttribute(String, Object) should be used in preference to the HTTP Session.
        Specified by:
        setHttpSessionAttribute in interface BayeuxContext
        Parameters:
        name - the attribute name
        value - the attribute value
      • getRemoteAddress

        public java.net.InetSocketAddress getRemoteAddress()
        Specified by:
        getRemoteAddress in interface BayeuxContext
        Returns:
        the remote socket address
      • getLocalAddress

        public java.net.InetSocketAddress getLocalAddress()
        Specified by:
        getLocalAddress in interface BayeuxContext
        Returns:
        the local socket address
      • getLocales

        public java.util.List<java.util.Locale> getLocales()
        Specified by:
        getLocales in interface BayeuxContext
        Returns:
        the request Locales, in order of preference, or the default server Locale if the request Locales are missing.
      • getCookie

        public java.lang.String getCookie​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Get a transport cookie.

        Get a cookie for any current transport mechanism (eg HTTP request). For transports like websocket, the cookie may be from the initial handshake.

        Specified by:
        getCookie in interface BayeuxContext
        Parameters:
        name - The name of the cookie
        Returns:
        The cookie value or null if no current transport mechanism or no such cookie.
      • getRequestAttribute

        public java.lang.Object getRequestAttribute​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Access the Request (if any) attributes.
        Specified by:
        getRequestAttribute in interface BayeuxContext
        Parameters:
        name - the attribute name
        Returns:
        The attribute value
      • getContextAttribute

        public java.lang.Object getContextAttribute​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Access the ServletContext (if any) attributes.
        Specified by:
        getContextAttribute in interface BayeuxContext
        Parameters:
        name - the attribute name
        Returns:
        The attribute value
      • getContextInitParameter

        public java.lang.String getContextInitParameter​(java.lang.String name)
        Description copied from interface: BayeuxContext
        Access the ServletContext (if any) init parameter.
        Specified by:
        getContextInitParameter in interface BayeuxContext
        Parameters:
        name - the init parameter name
        Returns:
        The attribute value
      • getContextPath

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

        public java.lang.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 channel