Class WebSocketUpgradeRequest.ClientUpgradeRequestFacade
- All Implemented Interfaces:
UpgradeRequest
- Enclosing class:
WebSocketUpgradeRequest
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtensions(String... configs) Add WebSocket Extension Configuration(s) to requestvoidaddExtensions(ExtensionConfig... configs) Add WebSocket Extension Configuration(s) to Upgrade Request.voidRemove all headers from request.Get the list of Cookies on the Upgrade requestGet the list of WebSocket Extension Configurations for this Upgrade Request.Get a specific Header value from Upgrade RequestintgetHeaderInt(String name) Get the specific Header value, as anint, from the Upgrade Request.Get the headers as a Map of keys to value lists.getHeaders(String name) Get the specific header values (for multi-value headers)getHost()The host of the Upgrade Request URIThe HTTP version used for this Upgrade RequestThe HTTP method for this Upgrade Request.The WebSocket Origin of this Upgrade RequestReturns a map of the query parameters of the request.Get the WebSocket Protocol VersionGet the Query String of the request URI.Get the Request URIAccess the Servlet HTTP Session (if present)Get the list of offered WebSocket sub-protocols.Get the User Principal for this request.booleanhasSubProtocol(String test) Test if a specific sub-protocol is offeredvoidinit(ClientUpgradeRequest request) booleanTest if supplied Origin is the same as the RequestbooleanisSecure()Test if connection is secure.voidsetCookies(List<HttpCookie> cookies) Set the list of Cookies on the requestvoidsetExtensions(List<ExtensionConfig> configs) Set the list of WebSocket Extension configurations on the request.voidSet a specific header valuevoidSet a specific header with multi-value fieldvoidsetHeaders(Map<String, List<String>> headers) Sets multiple headers on the request.voidsetHttpVersion(String httpVersion) Set the HTTP Version to use.voidSet the HTTP method to use.voidsetRequestURI(URI uri) Set the Request URI to use for this request.voidsetSession(Object session) Set the Session associated with this request.voidsetSubProtocols(String... protocols) Set the offered WebSocket Sub-Protocol list.voidsetSubProtocols(List<String> protocols) Set the offered WebSocket Sub-Protocol list.private void
-
Field Details
-
extensions
-
subProtocols
-
session
-
-
Constructor Details
-
ClientUpgradeRequestFacade
public ClientUpgradeRequestFacade()
-
-
Method Details
-
init
-
getExtensions
Description copied from interface:UpgradeRequestGet 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:
getExtensionsin interfaceUpgradeRequest- Returns:
- the list of Extension configurations (in the order they were specified)
-
getSubProtocols
Description copied from interface:UpgradeRequestGet the list of offered WebSocket sub-protocols.- Specified by:
getSubProtocolsin interfaceUpgradeRequest- Returns:
- the list of offered sub-protocols
-
addExtensions
Description copied from interface:UpgradeRequestAdd WebSocket Extension Configuration(s) to Upgrade Request.This is merely the list of requested Extensions to use, see
UpgradeResponse.getExtensions()for what was negotiated- Specified by:
addExtensionsin interfaceUpgradeRequest- Parameters:
configs- the configuration(s) to add
-
addExtensions
Description copied from interface:UpgradeRequestAdd WebSocket Extension Configuration(s) to requestThis is merely the list of requested Extensions to use, see
UpgradeResponse.getExtensions()for what was negotiated- Specified by:
addExtensionsin interfaceUpgradeRequest- Parameters:
configs- the configuration(s) to add
-
clearHeaders
public void clearHeaders()Description copied from interface:UpgradeRequestRemove all headers from request.- Specified by:
clearHeadersin interfaceUpgradeRequest
-
getHeader
Description copied from interface:UpgradeRequestGet a specific Header value from Upgrade Request- Specified by:
getHeaderin interfaceUpgradeRequest- Parameters:
name- the name of the header- Returns:
- the value of the header (null if header does not exist)
-
getHeaderInt
Description copied from interface:UpgradeRequestGet the specific Header value, as anint, from the Upgrade Request.- Specified by:
getHeaderIntin interfaceUpgradeRequest- Parameters:
name- the name of the header- Returns:
- the value of the header as an
int(-1 if header does not exist)
-
getHeaders
Description copied from interface:UpgradeRequestGet the specific header values (for multi-value headers)- Specified by:
getHeadersin interfaceUpgradeRequest- Parameters:
name- the header name- Returns:
- the value list (null if no header exists)
-
getHttpVersion
Description copied from interface:UpgradeRequestThe HTTP version used for this Upgrade RequestAs of RFC6455 (December 2011) this is always
HTTP/1.1- Specified by:
getHttpVersionin interfaceUpgradeRequest- Returns:
- the HTTP Version used
-
getOrigin
Description copied from interface:UpgradeRequestThe WebSocket Origin of this Upgrade RequestSee RFC6455: Section 10.2 for details.
Equivalent to
UpgradeRequest.getHeader(String)passed the "Origin" header.- Specified by:
getOriginin interfaceUpgradeRequest- Returns:
- the Origin header
-
getParameterMap
Description copied from interface:UpgradeRequestReturns a map of the query parameters of the request.- Specified by:
getParameterMapin interfaceUpgradeRequest- Returns:
- a unmodifiable map of query parameters of the request.
-
getProtocolVersion
Description copied from interface:UpgradeRequestGet the WebSocket Protocol VersionAs of RFC6455, Jetty only supports version
13- Specified by:
getProtocolVersionin interfaceUpgradeRequest- Returns:
- the WebSocket protocol version
-
getQueryString
Description copied from interface:UpgradeRequestGet the Query String of the request URI.- Specified by:
getQueryStringin interfaceUpgradeRequest- Returns:
- the request uri query string
-
getRequestURI
Description copied from interface:UpgradeRequestGet the Request URI- Specified by:
getRequestURIin interfaceUpgradeRequest- Returns:
- the request URI
-
getSession
Description copied from interface:UpgradeRequestAccess the Servlet HTTP Session (if present)Note: Never present on a Client UpgradeRequest.
- Specified by:
getSessionin interfaceUpgradeRequest- Returns:
- the Servlet HTTPSession on server side UpgradeRequests
-
getUserPrincipal
Description copied from interface:UpgradeRequestGet the User Principal for this request.Only applicable when using UpgradeRequest from server side.
- Specified by:
getUserPrincipalin interfaceUpgradeRequest- Returns:
- the user principal
-
hasSubProtocol
Description copied from interface:UpgradeRequestTest if a specific sub-protocol is offered- Specified by:
hasSubProtocolin interfaceUpgradeRequest- Parameters:
test- the sub-protocol to test for- Returns:
- true if sub-protocol exists on request
-
isOrigin
Description copied from interface:UpgradeRequestTest if supplied Origin is the same as the Request- Specified by:
isOriginin interfaceUpgradeRequest- Parameters:
test- the supplied origin- Returns:
- true if the supplied origin matches the request origin
-
isSecure
public boolean isSecure()Description copied from interface:UpgradeRequestTest if connection is secure.- Specified by:
isSecurein interfaceUpgradeRequest- Returns:
- true if connection is secure.
-
setCookies
Description copied from interface:UpgradeRequestSet the list of Cookies on the request- Specified by:
setCookiesin interfaceUpgradeRequest- Parameters:
cookies- the cookies to use
-
setExtensions
Description copied from interface:UpgradeRequestSet the list of WebSocket Extension configurations on the request.- Specified by:
setExtensionsin interfaceUpgradeRequest- Parameters:
configs- the list of extension configurations
-
updateExtensionHeader
private void updateExtensionHeader() -
setHeader
Description copied from interface:UpgradeRequestSet a specific header with multi-value fieldOverrides any previous value for this named header
- Specified by:
setHeaderin interfaceUpgradeRequest- Parameters:
name- the name of the headervalues- the multi-value field
-
setHeader
Description copied from interface:UpgradeRequestSet a specific header valueOverrides any previous value for this named header
- Specified by:
setHeaderin interfaceUpgradeRequest- Parameters:
name- the header to setvalue- the value to set it to
-
setHeaders
Description copied from interface:UpgradeRequestSets 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:
setHeadersin interfaceUpgradeRequest- Parameters:
headers- the headers to set
-
setHttpVersion
Description copied from interface:UpgradeRequestSet the HTTP Version to use.As of RFC6455 (December 2011) this should always be
HTTP/1.1- Specified by:
setHttpVersionin interfaceUpgradeRequest- Parameters:
httpVersion- the HTTP version to use.
-
setMethod
Description copied from interface:UpgradeRequestSet the HTTP method to use.As of RFC6455 (December 2011) this is always
GET- Specified by:
setMethodin interfaceUpgradeRequest- Parameters:
method- the HTTP method to use.
-
setRequestURI
Description copied from interface:UpgradeRequestSet the Request URI to use for this request.Must be an absolute URI with scheme
'ws'or'wss'- Specified by:
setRequestURIin interfaceUpgradeRequest- Parameters:
uri- the Request URI
-
setSession
Description copied from interface:UpgradeRequestSet the Session associated with this request.Typically used to associate the Servlet HttpSession object.
- Specified by:
setSessionin interfaceUpgradeRequest- Parameters:
session- the session object to associate with this request
-
setSubProtocols
Description copied from interface:UpgradeRequestSet the offered WebSocket Sub-Protocol list.- Specified by:
setSubProtocolsin interfaceUpgradeRequest- Parameters:
protocols- the offered sub-protocol list
-
setSubProtocols
Description copied from interface:UpgradeRequestSet the offered WebSocket Sub-Protocol list.- Specified by:
setSubProtocolsin interfaceUpgradeRequest- Parameters:
protocols- the offered sub-protocol list
-
getCookies
Description copied from interface:UpgradeRequestGet the list of Cookies on the Upgrade request- Specified by:
getCookiesin interfaceUpgradeRequest- Returns:
- the list of Cookies
-
getHeaders
Description copied from interface:UpgradeRequestGet the headers as a Map of keys to value lists.- Specified by:
getHeadersin interfaceUpgradeRequest- Returns:
- the headers
-
getHost
Description copied from interface:UpgradeRequestThe host of the Upgrade Request URI- Specified by:
getHostin interfaceUpgradeRequest- Returns:
- host of the request URI
-
getMethod
Description copied from interface:UpgradeRequestThe HTTP method for this Upgrade Request.As of RFC6455 (December 2011) this is always
GET- Specified by:
getMethodin interfaceUpgradeRequest- Returns:
- the HTTP method used
-