Class ServerUpgradeRequest


  • public class ServerUpgradeRequest
    extends java.lang.Object
    Upgrade request used for websocket negotiation. Provides getters for things like the requested extensions and subprotocols so that the headers don't have to be parsed manually.
    • Method Detail

      • getCertificates

        public java.security.cert.X509Certificate[] getCertificates()
        Returns:
        The X509Certificate instance at request attribute "javax.servlet.request.X509Certificate" or null.
      • getCookies

        public java.util.List<java.net.HttpCookie> getCookies()
        Returns:
        Request cookies
        See Also:
        HttpServletRequest.getCookies()
      • getHeader

        public java.lang.String getHeader​(java.lang.String name)
        Parameters:
        name - Header name
        Returns:
        Header value or null
        See Also:
        HttpServletRequest.getHeader(String)
      • getHeaderInt

        public int getHeaderInt​(java.lang.String name)
        Parameters:
        name - Header name
        Returns:
        Header value as integer or -1
        See Also:
        HttpServletRequest.getHeader(String)
      • getHeaders

        public java.util.List<java.lang.String> getHeaders​(java.lang.String name)
        Parameters:
        name - Header name
        Returns:
        List of header values or null
        See Also:
        UpgradeHttpServletRequest.getHeaders()
      • getHost

        public java.lang.String getHost()
        Returns:
        The requested host
        See Also:
        HttpServletRequest.getRequestURL()
      • getHttpServletRequest

        public javax.servlet.http.HttpServletRequest getHttpServletRequest()
        Returns:
        Immutable version of HttpServletRequest
      • getHttpVersion

        public java.lang.String getHttpVersion()
        Returns:
        The HTTP protocol version
        See Also:
        ServletRequest.getProtocol()
      • getLocale

        public java.util.Locale getLocale()
        Returns:
        The requested Locale
        See Also:
        ServletRequest.getLocale()
      • getLocales

        public java.util.Enumeration<java.util.Locale> getLocales()
        Returns:
        The requested Locales
        See Also:
        ServletRequest.getLocales()
      • getLocalSocketAddress

        public java.net.SocketAddress getLocalSocketAddress()
        Returns:
        The local requested address, which is typically an InetSocketAddress, but may be another derivation of SocketAddress
        See Also:
        ServletRequest.getLocalAddr(), ServletRequest.getLocalPort()
      • getMethod

        public java.lang.String getMethod()
        Returns:
        The requested method
        See Also:
        HttpServletRequest.getMethod()
      • getOrigin

        public java.lang.String getOrigin()
        Returns:
        The origin header value
      • getParameterMap

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameterMap()
        Returns:
        The request parameter map
        See Also:
        ServletRequest.getParameterMap()
      • getProtocolVersion

        public java.lang.String getProtocolVersion()
        Returns:
        WebSocket protocol version from "Sec-WebSocket-Version" header
      • getQueryString

        public java.lang.String getQueryString()
        Returns:
        The request query string
        See Also:
        HttpServletRequest.getQueryString()
      • getRemoteSocketAddress

        public java.net.SocketAddress getRemoteSocketAddress()
        Returns:
        The remote request address, which is typically an InetSocketAddress, but may be another derivation of SocketAddress
        See Also:
        ServletRequest.getRemoteAddr(), ServletRequest.getRemotePort()
      • getRequestPath

        public java.lang.String getRequestPath()
        Returns:
        The request URI path within the context
      • getRequestURI

        public java.net.URI getRequestURI()
        Returns:
        The request URI
        See Also:
        HttpServletRequest.getRequestURL()
      • getPathInContext

        public java.lang.String getPathInContext()
        Returns:
        the path within the context, combination of the ServletPath with the PathInfo.
      • getServletAttribute

        public java.lang.Object getServletAttribute​(java.lang.String name)
        Parameters:
        name - Attribute name
        Returns:
        Attribute value or null
        See Also:
        ServletRequest.getAttribute(String)
      • getServletAttributes

        public java.util.Map<java.lang.String,​java.lang.Object> getServletAttributes()
        Returns:
        Request attribute map
      • getServletParameters

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getServletParameters()
        Returns:
        Request parameters
        See Also:
        ServletRequest.getParameterMap()
      • getSession

        public javax.servlet.http.HttpSession getSession()
        Returns:
        The HttpSession, which may be null or invalidated
        See Also:
        HttpServletRequest.getSession(boolean)
      • getSubProtocols

        public java.util.List<java.lang.String> getSubProtocols()
        Returns:
        Get WebSocket negotiation offered sub protocols
      • getUserPrincipal

        public java.security.Principal getUserPrincipal()
        Returns:
        The User's Principal or null
        See Also:
        HttpServletRequest.getUserPrincipal()
      • hasSubProtocol

        public boolean hasSubProtocol​(java.lang.String subprotocol)
        Parameters:
        subprotocol - A sub protocol name
        Returns:
        True if the sub protocol was offered
      • isSecure

        public boolean isSecure()
        Returns:
        True if the request is secure
        See Also:
        ServletRequest.isSecure()
      • isUserInRole

        public boolean isUserInRole​(java.lang.String role)
        Parameters:
        role - The user role
        Returns:
        True if the requests user has the role
        See Also:
        HttpServletRequest.isUserInRole(String)
      • setServletAttribute

        public void setServletAttribute​(java.lang.String name,
                                        java.lang.Object value)
        Parameters:
        name - Attribute name
        value - Attribute value to set
        See Also:
        ServletRequest.setAttribute(String, Object)