public final class RequestContext extends UpgradeRequest
Modifier and Type | Class and Description |
---|---|
static class |
RequestContext.Builder
RequestContext builder. |
AUTHORIZATION, CLUSTER_CONNECTION_ID_HEADER, CONNECTION, ENABLE_TRACING_HEADER, HOST, ORIGIN_HEADER, RESPONSE_CODE_MESSAGE, SEC_WS_ORIGIN_HEADER, SERVER_KEY_HASH, TRACING_THRESHOLD, UPGRADE, WEBSOCKET
SEC_WEBSOCKET_EXTENSIONS, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getHeader(java.lang.String name)
Returns the header value corresponding to the name.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders()
Get headers.
|
java.lang.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.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getParameterMap()
Return the request parameters associated with the request.
|
java.lang.String |
getQueryString()
Return the query string associated with the request.
|
java.lang.String |
getRemoteAddr()
Get the Internet Protocol (IP) address of the client or last proxy that sent the request.
|
java.lang.String |
getRequestUri()
Get the undecoded request uri (up to the query string) of underlying
HTTP handshake request.
|
java.net.URI |
getRequestURI()
Return the request URI of the handshake request.
|
java.security.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(java.lang.String role)
Checks whether the current user is in the given role.
|
void |
lock()
Make headers and parameter map read-only.
|
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
public java.lang.String getHeader(java.lang.String name)
getHeader
in class UpgradeRequest
name
- header name.List
of header values iff found, null
otherwise.public void lock()
public java.security.Principal getUserPrincipal()
HandshakeRequest
null
if no user is authenticated for this handshake.public java.net.URI getRequestURI()
HandshakeRequest
public boolean isUserInRole(java.lang.String role)
HandshakeRequest
false
.role
- the role being checked.public java.lang.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 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()
HandshakeRequest
public java.lang.String getQueryString()
HandshakeRequest
public java.lang.String getRequestUri()
UpgradeRequest
getRequestUri
in class UpgradeRequest
public boolean isSecure()
UpgradeRequest
isSecure
in class UpgradeRequest
public java.lang.String getRemoteAddr()
String
containing the IP address of the client that sent the request or null
when
method is called on client-side.Copyright © 2012–2020 Oracle Corporation. All rights reserved.