public final class RequestContext extends UpgradeRequest
Modifier and Type | Class and Description |
---|---|
static class |
RequestContext.Builder
RequestContext builder. |
CLUSTER_CONNECTION_ID_HEADER, CONNECTION, HOST, ORIGIN_HEADER, RESPONSE_CODE_MESSAGE, SEC_WS_ORIGIN_HEADER, SERVER_KEY_HASH, UPGRADE, WEBSOCKET
SEC_WEBSOCKET_EXTENSIONS, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION
Modifier and Type | Method and Description |
---|---|
String |
getHeader(String name)
Returns the header value corresponding to the name.
|
Map<String,List<String>> |
getHeaders()
Get headers.
|
Object |
getHttpSession()
Return a reference to the HttpSession that the web socket handshake that
started this conversation was part of, if the implementation
is part of a Java EE web container.
|
Map<String,List<String>> |
getParameterMap()
Return the request parameters associated with the request.
|
String |
getQueryString()
Return the query string associated with the request.
|
String |
getRequestUri()
Get the undecoded request uri (up to the query string) of underlying
HTTP handshake request.
|
URI |
getRequestURI()
Return the request URI of the handshake request.
|
Principal |
getUserPrincipal()
Return the authenticated user or
null if no user is authenticated
for this handshake. |
boolean |
isSecure()
Indicates whether this request was made using a secure channel
(such as HTTPS).
|
boolean |
isUserInRole(String role)
Checks whether the current user is in the given role.
|
void |
lock()
Make headers and parameter map read-only.
|
public Map<String,List<String>> getHeaders()
public String getHeader(String name)
getHeader
in class UpgradeRequest
name
- header name.List
of header values iff found, null
otherwise.public void lock()
public Principal getUserPrincipal()
HandshakeRequest
null
if no user is authenticated
for this handshake.public URI getRequestURI()
HandshakeRequest
public boolean isUserInRole(String role)
HandshakeRequest
false
.role
- the role being checked.public Object getHttpSession()
HandshakeRequest
null
if either the websocket
implementation is not part of a Java EE web container, or there is
no HttpSession associated with the opening handshake request.public Map<String,List<String>> getParameterMap()
HandshakeRequest
public String getQueryString()
HandshakeRequest
public String getRequestUri()
UpgradeRequest
getRequestUri
in class UpgradeRequest
public boolean isSecure()
UpgradeRequest
isSecure
in class UpgradeRequest
Copyright © 2012-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.