Class ServletUpgradeRequest

  • All Implemented Interfaces:
    org.eclipse.jetty.websocket.api.UpgradeRequest

    public class ServletUpgradeRequest
    extends java.lang.Object
    implements org.eclipse.jetty.websocket.api.UpgradeRequest
    Servlet specific UpgradeRequest implementation.
    • Constructor Detail

      • ServletUpgradeRequest

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

      • addExtensions

        public void addExtensions​(org.eclipse.jetty.websocket.api.extensions.ExtensionConfig... configs)
        Specified by:
        addExtensions in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • addExtensions

        public void addExtensions​(java.lang.String... configs)
        Specified by:
        addExtensions in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • clearHeaders

        public void clearHeaders()
        Specified by:
        clearHeaders in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • complete

        public void complete()
      • getCertificates

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

        public java.util.List<java.net.HttpCookie> getCookies()
        Specified by:
        getCookies in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getExtensions

        public java.util.List<org.eclipse.jetty.websocket.api.extensions.ExtensionConfig> getExtensions()
        Specified by:
        getExtensions in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getHeader

        public java.lang.String getHeader​(java.lang.String name)
        Specified by:
        getHeader in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getHeaderInt

        public int getHeaderInt​(java.lang.String name)
        Specified by:
        getHeaderInt in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getHeaders

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
        Specified by:
        getHeaders in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getHeaders

        public java.util.List<java.lang.String> getHeaders​(java.lang.String name)
        Specified by:
        getHeaders in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getHost

        public java.lang.String getHost()
        Specified by:
        getHost in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getHttpServletRequest

        public javax.servlet.http.HttpServletRequest getHttpServletRequest()
        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
      • getHttpVersion

        public java.lang.String getHttpVersion()
        Specified by:
        getHttpVersion in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getLocalAddress

        public java.lang.String getLocalAddress()
        Equivalent to ServletRequest.getLocalAddr()
        Returns:
        the local address
      • getLocale

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

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

        public java.lang.String getLocalHostName()
        Equivalent to ServletRequest.getLocalName()
        Returns:
        the local host name
      • getLocalPort

        public int getLocalPort()
        Equivalent to ServletRequest.getLocalPort()
        Returns:
        the local port
      • getLocalSocketAddress

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

        Warning: this can cause a DNS lookup

        Returns:
        the local socket address
      • getMethod

        public java.lang.String getMethod()
        Specified by:
        getMethod in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getOrigin

        public java.lang.String getOrigin()
        Specified by:
        getOrigin in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getParameterMap

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameterMap()
        Specified by:
        getParameterMap in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getPrincipal

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

        public java.lang.String getProtocolVersion()
        Specified by:
        getProtocolVersion in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getQueryString

        public java.lang.String getQueryString()
        Specified by:
        getQueryString in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getRemoteAddress

        public java.lang.String getRemoteAddress()
        Equivalent to ServletRequest.getRemoteAddr()
        Returns:
        the remote address
      • getRemoteHostName

        public java.lang.String getRemoteHostName()
        Equivalent to ServletRequest.getRemoteHost()
        Returns:
        the remote host name
      • getRemotePort

        public int getRemotePort()
        Equivalent to ServletRequest.getRemotePort()
        Returns:
        the remote port
      • getRemoteSocketAddress

        public java.net.InetSocketAddress getRemoteSocketAddress()
        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()
      • getRequestURI

        public java.net.URI getRequestURI()
        Specified by:
        getRequestURI in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getServletAttribute

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

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

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

        public javax.servlet.http.HttpSession getSession()
        Return the HttpSession if it exists.

        Note: this is equivalent to HttpServletRequest.getSession(boolean) and will not create a new HttpSession.

        Specified by:
        getSession in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getSubProtocols

        public java.util.List<java.lang.String> getSubProtocols()
        Specified by:
        getSubProtocols in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • getUserPrincipal

        public java.security.Principal getUserPrincipal()
        Equivalent to HttpServletRequest.getUserPrincipal()
        Specified by:
        getUserPrincipal in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • hasSubProtocol

        public boolean hasSubProtocol​(java.lang.String test)
        Specified by:
        hasSubProtocol in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • isOrigin

        public boolean isOrigin​(java.lang.String test)
        Specified by:
        isOrigin in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • isSecure

        public boolean isSecure()
        Specified by:
        isSecure in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • isUserInRole

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

        public void setCookies​(java.util.List<java.net.HttpCookie> cookies)
        Specified by:
        setCookies in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setExtensions

        public void setExtensions​(java.util.List<org.eclipse.jetty.websocket.api.extensions.ExtensionConfig> configs)
        Specified by:
        setExtensions in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setHeader

        public void setHeader​(java.lang.String name,
                              java.util.List<java.lang.String> values)
        Specified by:
        setHeader in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setHeader

        public void setHeader​(java.lang.String name,
                              java.lang.String value)
        Specified by:
        setHeader in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setHeaders

        public void setHeaders​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers)
        Specified by:
        setHeaders in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setHttpVersion

        public void setHttpVersion​(java.lang.String httpVersion)
        Specified by:
        setHttpVersion in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setMethod

        public void setMethod​(java.lang.String method)
        Specified by:
        setMethod in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setRequestURI

        public void setRequestURI​(java.net.URI uri)
        Specified by:
        setRequestURI in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setServletAttribute

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

        public void setSession​(java.lang.Object session)
        Specified by:
        setSession in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setSubProtocols

        public void setSubProtocols​(java.util.List<java.lang.String> subProtocols)
        Specified by:
        setSubProtocols in interface org.eclipse.jetty.websocket.api.UpgradeRequest
      • setSubProtocols

        public void setSubProtocols​(java.lang.String... protocols)
        Specified by:
        setSubProtocols in interface org.eclipse.jetty.websocket.api.UpgradeRequest