Top Description Methods
org.eclipse.jetty.websocket.api

public Interface UpgradeRequest

Imports
java.net.HttpCookie, .URI, java.security.Principal, java.util.List, .Map

The HTTP Upgrade to WebSocket Request

Method Summary

Modifier and TypeMethod and Description
public List<HttpCookie>

Returns:

the list of Cookies
getCookies
()

Get the list of Cookies on the Upgrade request

public List<ExtensionConfig>

Returns:

the list of Extension configurations (in the order they were specified)
getExtensions
()

Get the list of WebSocket Extension Configurations for this Upgrade Request.

public String

Returns:

the value of the header (null if header does not exist)
getHeader
(String
the name of the header
name
)

Get a specific Header value from Upgrade Request

public int

Returns:

the value of the header as an int (-1 if header does not exist)
getHeaderInt
(String
the name of the header
name
)

Get the specific Header value, as an int, from the Upgrade Request.

public Map<String, List<String>>

Returns:

the headers
getHeaders
()

Get the headers as a Map of keys to value lists.

public List<String>

Returns:

the value list (null if no header exists)
getHeaders
(String
the header name
name
)

Get the specific header values (for multi-value headers)

public String

Returns:

host of the request URI
getHost
()

The host of the Upgrade Request URI

public String

Returns:

the HTTP Version used
getHttpVersion
()

The HTTP version used for this Upgrade Request

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

public String

Returns:

the HTTP method used
getMethod
()

The HTTP method for this Upgrade Request.

public String

Returns:

the Origin header
getOrigin
()

The WebSocket Origin of this Upgrade Request

See RFC6455: Section 10.2 for details.

public Map<String, List<String>>

Returns:

a unmodifiable map of query parameters of the request.
getParameterMap
()

Returns a map of the query parameters of the request.

public String

Returns:

the WebSocket protocol version
getProtocolVersion
()

Get the WebSocket Protocol Version

As of RFC6455, Jetty only supports version 13

public String

Returns:

the request uri query string
getQueryString
()

Get the Query String of the request URI.

public URI

Returns:

the request URI
getRequestURI
()

Get the Request URI

public List<String>

Returns:

the list of offered sub-protocols
getSubProtocols
()

Get the list of offered WebSocket sub-protocols.

public Principal

Returns:

the user principal
getUserPrincipal
()

Get the User Principal for this request.

public boolean

Returns:

true if sub-protocol exists on request
hasSubProtocol
(String
the sub-protocol to test for
test
)

Test if a specific sub-protocol is offered

public boolean

Returns:

true if connection is secure.
isSecure
()

Test if connection is secure.

Method Detail

getCookiesback to summary
public List<HttpCookie> getCookies()

Get the list of Cookies on the Upgrade request

Returns:List<HttpCookie>

the list of Cookies

getExtensionsback to summary
public 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:List<ExtensionConfig>

the list of Extension configurations (in the order they were specified)

getHeaderback to summary
public String getHeader(String name)

Get a specific Header value from Upgrade Request

Parameters
name:String

the name of the header

Returns:String

the value of the header (null if header does not exist)

getHeaderIntback to summary
public int getHeaderInt(String name)

Get the specific Header value, as an int, from the Upgrade Request.

Parameters
name:String

the name of the header

Returns:int

the value of the header as an int (-1 if header does not exist)

Exceptions
NumberFormatException:
if unable to parse value as an int.
getHeadersback to summary
public Map<String, List<String>> getHeaders()

Get the headers as a Map of keys to value lists.

Returns:Map<String, List<String>>

the headers

getHeadersback to summary
public List<String> getHeaders(String name)

Get the specific header values (for multi-value headers)

Parameters
name:String

the header name

Returns:List<String>

the value list (null if no header exists)

getHostback to summary
public String getHost()

The host of the Upgrade Request URI

Returns:String

host of the request URI

getHttpVersionback to summary
public String getHttpVersion()

The HTTP version used for this Upgrade Request

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

Returns:String

the HTTP Version used

getMethodback to summary
public String getMethod()

The HTTP method for this Upgrade Request.

As of RFC6455 (December 2011) this is always GET

Returns:String

the HTTP method used

getOriginback to summary
public 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:String

the Origin header

getParameterMapback to summary
public Map<String, List<String>> getParameterMap()

Returns a map of the query parameters of the request.

Returns:Map<String, List<String>>

a unmodifiable map of query parameters of the request.

getProtocolVersionback to summary
public String getProtocolVersion()

Get the WebSocket Protocol Version

As of RFC6455, Jetty only supports version 13

Returns:String

the WebSocket protocol version

getQueryStringback to summary
public String getQueryString()

Get the Query String of the request URI.

Returns:String

the request uri query string

getRequestURIback to summary
public URI getRequestURI()

Get the Request URI

Returns:URI

the request URI

getSubProtocolsback to summary
public List<String> getSubProtocols()

Get the list of offered WebSocket sub-protocols.

Returns:List<String>

the list of offered sub-protocols

getUserPrincipalback to summary
public Principal getUserPrincipal()

Get the User Principal for this request.

Only applicable when using UpgradeRequest from server side.

Returns:Principal

the user principal

hasSubProtocolback to summary
public boolean hasSubProtocol(String test)

Test if a specific sub-protocol is offered

Parameters
test:String

the sub-protocol to test for

Returns:boolean

true if sub-protocol exists on request

isSecureback to summary
public boolean isSecure()

Test if connection is secure.

Returns:boolean

true if connection is secure.