Interface UpgradeRequest

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<java.net.HttpCookie> getCookies()
      Get the list of Cookies on the Upgrade request
      java.util.List<ExtensionConfig> getExtensions()
      Get the list of WebSocket Extension Configurations for this Upgrade Request.
      java.lang.String getHeader​(java.lang.String name)
      Get a specific Header value from Upgrade Request
      int getHeaderInt​(java.lang.String name)
      Get the specific Header value, as an int, from the Upgrade Request.
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
      Get the headers as a Map of keys to value lists.
      java.util.List<java.lang.String> getHeaders​(java.lang.String name)
      Get the specific header values (for multi-value headers)
      java.lang.String getHost()
      The host of the Upgrade Request URI
      java.lang.String getHttpVersion()
      The HTTP version used for this Upgrade Request
      java.lang.String getMethod()
      The HTTP method for this Upgrade Request.
      java.lang.String getOrigin()
      The WebSocket Origin of this Upgrade Request
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameterMap()
      Returns a map of the query parameters of the request.
      java.lang.String getProtocolVersion()
      Get the WebSocket Protocol Version
      java.lang.String getQueryString()
      Get the Query String of the request URI.
      java.net.URI getRequestURI()
      Get the Request URI
      java.util.List<java.lang.String> getSubProtocols()
      Get the list of offered WebSocket sub-protocols.
      java.security.Principal getUserPrincipal()
      Get the User Principal for this request.
      boolean hasSubProtocol​(java.lang.String test)
      Test if a specific sub-protocol is offered
      boolean isSecure()
      Test if connection is secure.
    • Method Detail

      • getCookies

        java.util.List<java.net.HttpCookie> getCookies()
        Get the list of Cookies on the Upgrade request
        Returns:
        the list of Cookies
      • getExtensions

        java.util.List<ExtensionConfig> getExtensions()
        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

        Returns:
        the list of Extension configurations (in the order they were specified)
      • getHeader

        java.lang.String getHeader​(java.lang.String name)
        Get a specific Header value from Upgrade Request
        Parameters:
        name - the name of the header
        Returns:
        the value of the header (null if header does not exist)
      • getHeaderInt

        int getHeaderInt​(java.lang.String name)
        Get the specific Header value, as an int, from the Upgrade Request.
        Parameters:
        name - the name of the header
        Returns:
        the value of the header as an int (-1 if header does not exist)
        Throws:
        java.lang.NumberFormatException - if unable to parse value as an int.
      • getHeaders

        java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getHeaders()
        Get the headers as a Map of keys to value lists.
        Returns:
        the headers
      • getHeaders

        java.util.List<java.lang.String> getHeaders​(java.lang.String name)
        Get the specific header values (for multi-value headers)
        Parameters:
        name - the header name
        Returns:
        the value list (null if no header exists)
      • getHost

        java.lang.String getHost()
        The host of the Upgrade Request URI
        Returns:
        host of the request URI
      • getHttpVersion

        java.lang.String getHttpVersion()
        The HTTP version used for this Upgrade Request

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

        Returns:
        the HTTP Version used
      • getMethod

        java.lang.String getMethod()
        The HTTP method for this Upgrade Request.

        As of RFC6455 (December 2011) this is always GET

        Returns:
        the HTTP method used
      • getOrigin

        java.lang.String getOrigin()
        The WebSocket Origin of this Upgrade Request

        See RFC6455: Section 10.2 for details.

        Equivalent to getHeader(String) passed the "Origin" header.

        Returns:
        the Origin header
      • getParameterMap

        java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getParameterMap()
        Returns a map of the query parameters of the request.
        Returns:
        a unmodifiable map of query parameters of the request.
      • getProtocolVersion

        java.lang.String getProtocolVersion()
        Get the WebSocket Protocol Version

        As of RFC6455, Jetty only supports version 13

        Returns:
        the WebSocket protocol version
      • getQueryString

        java.lang.String getQueryString()
        Get the Query String of the request URI.
        Returns:
        the request uri query string
      • getRequestURI

        java.net.URI getRequestURI()
        Get the Request URI
        Returns:
        the request URI
      • getSubProtocols

        java.util.List<java.lang.String> getSubProtocols()
        Get the list of offered WebSocket sub-protocols.
        Returns:
        the list of offered sub-protocols
      • getUserPrincipal

        java.security.Principal getUserPrincipal()
        Get the User Principal for this request.

        Only applicable when using UpgradeRequest from server side.

        Returns:
        the user principal
      • hasSubProtocol

        boolean hasSubProtocol​(java.lang.String test)
        Test if a specific sub-protocol is offered
        Parameters:
        test - the sub-protocol to test for
        Returns:
        true if sub-protocol exists on request
      • isSecure

        boolean isSecure()
        Test if connection is secure.
        Returns:
        true if connection is secure.