Class ServletUpgradeRequest

  • All Implemented Interfaces:
    UpgradeRequest
    Direct Known Subclasses:
    ServletWebSocketRequest

    @Deprecated(since="2021-05-27")
    public class ServletUpgradeRequest
    extends java.lang.Object
    implements UpgradeRequest
    Deprecated.
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
    Servlet specific UpgradeRequest implementation.
    • Constructor Detail

      • ServletUpgradeRequest

        public ServletUpgradeRequest​(HttpServletRequest httpRequest)
                              throws java.net.URISyntaxException
        Deprecated.
        Throws:
        java.net.URISyntaxException
    • Method Detail

      • addExtensions

        public void addExtensions​(java.lang.String... configs)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Add WebSocket Extension Configuration(s) to request

        This is merely the list of requested Extensions to use, see UpgradeResponse.getExtensions() for what was negotiated

        Specified by:
        addExtensions in interface UpgradeRequest
        Parameters:
        configs - the configuration(s) to add
      • complete

        public void complete()
        Deprecated.
      • getCertificates

        public java.security.cert.X509Certificate[] getCertificates()
        Deprecated.
      • getCookies

        public java.util.List<java.net.HttpCookie> getCookies()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the list of Cookies on the Upgrade request
        Specified by:
        getCookies in interface UpgradeRequest
        Returns:
        the list of Cookies
      • getExtensions

        public java.util.List<ExtensionConfig> getExtensions()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the list of WebSocket Extension Configurations for this Upgrade Request.

        This is merely the list of requested Extensions to use, see UpgradeResponse.getExtensions() for what was negotiated

        Specified by:
        getExtensions in interface UpgradeRequest
        Returns:
        the list of Extension configurations (in the order they were specified)
      • getHeader

        public java.lang.String getHeader​(java.lang.String name)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get a specific Header value from Upgrade Request
        Specified by:
        getHeader in interface UpgradeRequest
        Parameters:
        name - the name of the header
        Returns:
        the value of the header (null if header does not exist)
      • getHeaderInt

        public int getHeaderInt​(java.lang.String name)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the specific Header value, as an int, from the Upgrade Request.
        Specified by:
        getHeaderInt in interface UpgradeRequest
        Parameters:
        name - the name of the header
        Returns:
        the value of the header as an int (-1 if header does not exist)
      • getHeaders

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the headers as a Map of keys to value lists.
        Specified by:
        getHeaders in interface UpgradeRequest
        Returns:
        the headers
      • getHeaders

        public java.util.List<java.lang.String> getHeaders​(java.lang.String name)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the specific header values (for multi-value headers)
        Specified by:
        getHeaders in interface UpgradeRequest
        Parameters:
        name - the header name
        Returns:
        the value list (null if no header exists)
      • getHost

        public java.lang.String getHost()
        Deprecated.
        Description copied from interface: UpgradeRequest
        The host of the Upgrade Request URI
        Specified by:
        getHost in interface UpgradeRequest
        Returns:
        host of the request URI
      • getHttpServletRequest

        public HttpServletRequest getHttpServletRequest()
        Deprecated.
        Return the underlying HttpServletRequest that existed at Upgrade time.

        Note: many features of the HttpServletRequest are invalid when upgraded, especially ones that deal with body content, streams, readers, and responses.

        Returns:
        a limited version of the underlying HttpServletRequest
      • getLocale

        public java.util.Locale getLocale()
        Deprecated.
        Returns:
        the preferred Locale for the client
      • getLocales

        public java.util.Enumeration<java.util.Locale> getLocales()
        Deprecated.
        Returns:
        an Enumeration of preferred Locale objects
      • getLocalHostName

        public java.lang.String getLocalHostName()
        Deprecated.
        Returns:
        the local host name
      • getLocalSocketAddress

        public java.net.InetSocketAddress getLocalSocketAddress()
        Deprecated.
        Return a InetSocketAddress for the local socket.

        Warning: this can cause a DNS lookup

        Returns:
        the local socket address
      • getParameterMap

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameterMap()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Returns a map of the query parameters of the request.
        Specified by:
        getParameterMap in interface UpgradeRequest
        Returns:
        a unmodifiable map of query parameters of the request.
      • getPrincipal

        @Deprecated
        public java.security.Principal getPrincipal()
        Deprecated.
        use getUserPrincipal() instead
        Returns:
        the principal
      • getProtocolVersion

        public java.lang.String getProtocolVersion()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the WebSocket Protocol Version

        As of RFC6455, Jetty only supports version 13

        Specified by:
        getProtocolVersion in interface UpgradeRequest
        Returns:
        the WebSocket protocol version
      • getQueryString

        public java.lang.String getQueryString()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the Query String of the request URI.
        Specified by:
        getQueryString in interface UpgradeRequest
        Returns:
        the request uri query string
      • getRemoteHostName

        public java.lang.String getRemoteHostName()
        Deprecated.
        Returns:
        the remote host name
      • getRemoteSocketAddress

        public java.net.InetSocketAddress getRemoteSocketAddress()
        Deprecated.
        Return a InetSocketAddress for the remote socket.

        Warning: this can cause a DNS lookup

        Returns:
        the remote socket address
      • getRequestPath

        public java.lang.String getRequestPath()
        Deprecated.
      • getRequestURI

        public java.net.URI getRequestURI()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the Request URI
        Specified by:
        getRequestURI in interface UpgradeRequest
        Returns:
        the request URI
      • getServletAttribute

        public java.lang.Object getServletAttribute​(java.lang.String name)
        Deprecated.
      • getServletAttributes

        public java.util.Map<java.lang.String,​java.lang.Object> getServletAttributes()
        Deprecated.
      • getServletParameters

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getServletParameters()
        Deprecated.
      • getSubProtocols

        public java.util.List<java.lang.String> getSubProtocols()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Get the list of offered WebSocket sub-protocols.
        Specified by:
        getSubProtocols in interface UpgradeRequest
        Returns:
        the list of offered sub-protocols
      • hasSubProtocol

        public boolean hasSubProtocol​(java.lang.String test)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Test if a specific sub-protocol is offered
        Specified by:
        hasSubProtocol in interface UpgradeRequest
        Parameters:
        test - the sub-protocol to test for
        Returns:
        true if sub-protocol exists on request
      • isOrigin

        public boolean isOrigin​(java.lang.String test)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Test if supplied Origin is the same as the Request
        Specified by:
        isOrigin in interface UpgradeRequest
        Parameters:
        test - the supplied origin
        Returns:
        true if the supplied origin matches the request origin
      • isSecure

        public boolean isSecure()
        Deprecated.
        Description copied from interface: UpgradeRequest
        Test if connection is secure.
        Specified by:
        isSecure in interface UpgradeRequest
        Returns:
        true if connection is secure.
      • isUserInRole

        public boolean isUserInRole​(java.lang.String role)
        Deprecated.
      • setCookies

        public void setCookies​(java.util.List<java.net.HttpCookie> cookies)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the list of Cookies on the request
        Specified by:
        setCookies in interface UpgradeRequest
        Parameters:
        cookies - the cookies to use
      • setExtensions

        public void setExtensions​(java.util.List<ExtensionConfig> configs)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the list of WebSocket Extension configurations on the request.
        Specified by:
        setExtensions in interface UpgradeRequest
        Parameters:
        configs - the list of extension configurations
      • setHeader

        public void setHeader​(java.lang.String name,
                              java.util.List<java.lang.String> values)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set a specific header with multi-value field

        Overrides any previous value for this named header

        Specified by:
        setHeader in interface UpgradeRequest
        Parameters:
        name - the name of the header
        values - the multi-value field
      • setHeader

        public void setHeader​(java.lang.String name,
                              java.lang.String value)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set a specific header value

        Overrides any previous value for this named header

        Specified by:
        setHeader in interface UpgradeRequest
        Parameters:
        name - the header to set
        value - the value to set it to
      • setHeaders

        public void setHeaders​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Sets multiple headers on the request.

        Only sets those headers provided, does not remove headers that exist on request and are not provided in the parameter for this method.

        Convenience method vs calling UpgradeRequest.setHeader(String, List) multiple times.

        Specified by:
        setHeaders in interface UpgradeRequest
        Parameters:
        headers - the headers to set
      • setHttpVersion

        public void setHttpVersion​(java.lang.String httpVersion)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the HTTP Version to use.

        As of RFC6455 (December 2011) this should always be HTTP/1.1

        Specified by:
        setHttpVersion in interface UpgradeRequest
        Parameters:
        httpVersion - the HTTP version to use.
      • setMethod

        public void setMethod​(java.lang.String method)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the HTTP method to use.

        As of RFC6455 (December 2011) this is always GET

        Specified by:
        setMethod in interface UpgradeRequest
        Parameters:
        method - the HTTP method to use.
      • setRequestURI

        public void setRequestURI​(java.net.URI uri)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the Request URI to use for this request.

        Must be an absolute URI with scheme 'ws' or 'wss'

        Specified by:
        setRequestURI in interface UpgradeRequest
        Parameters:
        uri - the Request URI
      • setServletAttribute

        public void setServletAttribute​(java.lang.String name,
                                        java.lang.Object value)
        Deprecated.
      • setSession

        public void setSession​(java.lang.Object session)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the Session associated with this request.

        Typically used to associate the Servlet HttpSession object.

        Specified by:
        setSession in interface UpgradeRequest
        Parameters:
        session - the session object to associate with this request
      • setSubProtocols

        public void setSubProtocols​(java.util.List<java.lang.String> subProtocols)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the offered WebSocket Sub-Protocol list.
        Specified by:
        setSubProtocols in interface UpgradeRequest
        Parameters:
        subProtocols - the offered sub-protocol list
      • setSubProtocols

        public void setSubProtocols​(java.lang.String... protocols)
        Deprecated.
        Description copied from interface: UpgradeRequest
        Set the offered WebSocket Sub-Protocol list.
        Specified by:
        setSubProtocols in interface UpgradeRequest
        Parameters:
        protocols - the offered sub-protocol list