public class UpgradeRequestAdapter extends Object implements UpgradeRequest
| Constructor and Description |
|---|
UpgradeRequestAdapter(String requestURI) |
UpgradeRequestAdapter(URI requestURI) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExtensions(ExtensionConfig... configs)
Add WebSocket Extension Configuration(s) to Upgrade Request.
|
void |
addExtensions(String... configs)
Add WebSocket Extension Configuration(s) to request
|
void |
clearHeaders()
Remove all headers from request.
|
List<HttpCookie> |
getCookies()
Get the list of Cookies on the Upgrade request
|
List<ExtensionConfig> |
getExtensions()
Get the list of WebSocket Extension Configurations for this Upgrade Request.
|
String |
getHeader(String name)
Get a specific Header value from Upgrade Request
|
int |
getHeaderInt(String name)
Get the specific Header value, as an
int, from the Upgrade Request. |
Map<String,List<String>> |
getHeaders()
Get the headers as a Map of keys to value lists.
|
List<String> |
getHeaders(String name)
Get the specific header values (for multi-value headers)
|
String |
getHost()
The host of the Upgrade Request URI
|
String |
getHttpVersion()
The HTTP version used for this Upgrade Request
|
String |
getMethod()
The HTTP method for this Upgrade Request.
|
String |
getOrigin()
The WebSocket Origin of this Upgrade Request
|
Map<String,List<String>> |
getParameterMap()
Returns a map of the query parameters of the request.
|
String |
getProtocolVersion()
Get the WebSocket Protocol Version
|
String |
getQueryString()
Get the Query String of the request URI.
|
URI |
getRequestURI()
Get the Request URI
|
Object |
getSession()
Access the Servlet HTTP Session (if present)
|
List<String> |
getSubProtocols()
Get the list of offered WebSocket sub-protocols.
|
Principal |
getUserPrincipal()
Get the User Principal for this request.
|
boolean |
hasSubProtocol(String test)
Test if a specific sub-protocol is offered
|
boolean |
isOrigin(String test)
Test if supplied Origin is the same as the Request
|
boolean |
isSecure()
Test if connection is secure.
|
void |
setCookies(List<HttpCookie> cookies)
Set the list of Cookies on the request
|
void |
setExtensions(List<ExtensionConfig> configs)
Set the list of WebSocket Extension configurations on the request.
|
void |
setHeader(String name,
List<String> values)
Set a specific header with multi-value field
|
void |
setHeader(String name,
String value)
Set a specific header value
|
void |
setHeaders(Map<String,List<String>> headers)
Sets multiple headers on the request.
|
void |
setHttpVersion(String httpVersion)
Set the HTTP Version to use.
|
void |
setMethod(String method)
Set the HTTP method to use.
|
void |
setRequestURI(URI uri)
Set the Request URI to use for this request.
|
void |
setSession(Object session)
Set the Session associated with this request.
|
void |
setSubProtocols(List<String> subProtocols)
Set the offered WebSocket Sub-Protocol list.
|
void |
setSubProtocols(String... protocols)
Set Sub Protocol request list.
|
public UpgradeRequestAdapter(String requestURI)
public UpgradeRequestAdapter(URI requestURI)
public void addExtensions(ExtensionConfig... configs)
UpgradeRequest
This is merely the list of requested Extensions to use, see UpgradeResponse.getExtensions() for what was
negotiated
addExtensions in interface UpgradeRequestconfigs - the configuration(s) to addpublic void addExtensions(String... configs)
UpgradeRequest
This is merely the list of requested Extensions to use, see UpgradeResponse.getExtensions() for what was
negotiated
addExtensions in interface UpgradeRequestconfigs - the configuration(s) to addpublic void clearHeaders()
UpgradeRequestclearHeaders in interface UpgradeRequestpublic List<HttpCookie> getCookies()
UpgradeRequestgetCookies in interface UpgradeRequestpublic List<ExtensionConfig> getExtensions()
UpgradeRequest
This is merely the list of requested Extensions to use, see UpgradeResponse.getExtensions() for what was
negotiated
getExtensions in interface UpgradeRequestpublic String getHeader(String name)
UpgradeRequestgetHeader in interface UpgradeRequestname - the name of the headerpublic int getHeaderInt(String name)
UpgradeRequestint, from the Upgrade Request.getHeaderInt in interface UpgradeRequestname - the name of the headerint (-1 if header does not exist)public Map<String,List<String>> getHeaders()
UpgradeRequestgetHeaders in interface UpgradeRequestpublic List<String> getHeaders(String name)
UpgradeRequestgetHeaders in interface UpgradeRequestname - the header namepublic String getHost()
UpgradeRequestgetHost in interface UpgradeRequestpublic String getHttpVersion()
UpgradeRequest
As of RFC6455 (December 2011) this is always
HTTP/1.1
getHttpVersion in interface UpgradeRequestpublic String getMethod()
UpgradeRequest
As of RFC6455 (December 2011) this is always GET
getMethod in interface UpgradeRequestpublic String getOrigin()
UpgradeRequestSee RFC6455: Section 10.2 for details.
Equivalent to UpgradeRequest.getHeader(String) passed the "Origin" header.
getOrigin in interface UpgradeRequestpublic Map<String,List<String>> getParameterMap()
getParameterMap in interface UpgradeRequestpublic String getProtocolVersion()
UpgradeRequest
As of RFC6455, Jetty only supports version
13
getProtocolVersion in interface UpgradeRequestpublic String getQueryString()
UpgradeRequestgetQueryString in interface UpgradeRequestpublic URI getRequestURI()
UpgradeRequestgetRequestURI in interface UpgradeRequestpublic Object getSession()
Note: Never present on a Client UpgradeRequest.
getSession in interface UpgradeRequestpublic List<String> getSubProtocols()
UpgradeRequestgetSubProtocols in interface UpgradeRequestpublic Principal getUserPrincipal()
Only applicable when using UpgradeRequest from server side.
getUserPrincipal in interface UpgradeRequestpublic boolean hasSubProtocol(String test)
UpgradeRequesthasSubProtocol in interface UpgradeRequesttest - the sub-protocol to test forpublic boolean isOrigin(String test)
UpgradeRequestisOrigin in interface UpgradeRequesttest - the supplied originpublic boolean isSecure()
UpgradeRequestisSecure in interface UpgradeRequestpublic void setCookies(List<HttpCookie> cookies)
UpgradeRequestsetCookies in interface UpgradeRequestcookies - the cookies to usepublic void setExtensions(List<ExtensionConfig> configs)
UpgradeRequestsetExtensions in interface UpgradeRequestconfigs - the list of extension configurationspublic void setHeader(String name, List<String> values)
UpgradeRequestOverrides any previous value for this named header
setHeader in interface UpgradeRequestname - the name of the headervalues - the multi-value fieldpublic void setHeader(String name, String value)
UpgradeRequestOverrides any previous value for this named header
setHeader in interface UpgradeRequestname - the header to setvalue - the value to set it topublic void setHeaders(Map<String,List<String>> headers)
UpgradeRequestOnly 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.
setHeaders in interface UpgradeRequestheaders - the headers to setpublic void setHttpVersion(String httpVersion)
UpgradeRequest
As of RFC6455 (December 2011) this should always be
HTTP/1.1
setHttpVersion in interface UpgradeRequesthttpVersion - the HTTP version to use.public void setMethod(String method)
UpgradeRequest
As of RFC6455 (December 2011) this is always GET
setMethod in interface UpgradeRequestmethod - the HTTP method to use.public void setRequestURI(URI uri)
UpgradeRequest
Must be an absolute URI with scheme 'ws' or 'wss'
setRequestURI in interface UpgradeRequesturi - the Request URIpublic void setSession(Object session)
UpgradeRequestTypically used to associate the Servlet HttpSession object.
setSession in interface UpgradeRequestsession - the session object to associate with this requestpublic void setSubProtocols(List<String> subProtocols)
UpgradeRequestsetSubProtocols in interface UpgradeRequestsubProtocols - the offered sub-protocol listpublic void setSubProtocols(String... protocols)
setSubProtocols in interface UpgradeRequestprotocols - the sub protocols desiredCopyright © 2010 - 2020 Adobe. All Rights Reserved