Top Description Fields Methods
jakarta.websocket.server

public Interface HandshakeRequest

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

The handshake request represents the WebSocket defined HTTP GET request for the opening handshake of a WebSocket session.
Author
dannycoward

Field Summary

Modifier and TypeField and Description
public static final String
SEC_WEBSOCKET_EXTENSIONS

The Sec-WebSocket-Extensions header name

public static final String
SEC_WEBSOCKET_KEY

The Sec-WebSocket-Key header name

public static final String
SEC_WEBSOCKET_PROTOCOL

The Sec-WebSocket-Protocol header name

public static final String
SEC_WEBSOCKET_VERSION

The Sec-WebSocket-Version header name

Method Summary

Modifier and TypeMethod and Description
public Map<String, List<String>>

Returns:

the list of headers.
getHeaders
()

Return the read only map of HTTP headers to header values that came with the handshake request.

public Object

Returns:

the http session or 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.
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.

public Map<String, List<String>>

Returns:

the unmodifiable map of the request parameters.
getParameterMap
()

Return the request parameters associated with the request.

public String

Returns:

the query string.
getQueryString
()

Return the query string associated with the request.

public URI

Returns:

the request uri of the handshake request.
getRequestURI
()

Return the request URI of the handshake request.

public Principal

Returns:

the user principal.
getUserPrincipal
()

Return the authenticated user or null if no user is authenticated for this handshake.

public boolean

Returns:

whether the authenticated user is in the role, or false if the user has not been authenticated.
isUserInRole
(String
the role being checked.
role
)

Checks whether the current user is in the given role.

Field Detail

SEC_WEBSOCKET_EXTENSIONSback to summary
public static final String SEC_WEBSOCKET_EXTENSIONS

The Sec-WebSocket-Extensions header name

SEC_WEBSOCKET_KEYback to summary
public static final String SEC_WEBSOCKET_KEY

The Sec-WebSocket-Key header name

SEC_WEBSOCKET_PROTOCOLback to summary
public static final String SEC_WEBSOCKET_PROTOCOL

The Sec-WebSocket-Protocol header name

SEC_WEBSOCKET_VERSIONback to summary
public static final String SEC_WEBSOCKET_VERSION

The Sec-WebSocket-Version header name

Method Detail

getHeadersback to summary
public Map<String, List<String>> getHeaders()

Return the read only map of HTTP headers to header values that came with the handshake request. Note that the lookup of header names will be performed in a case insensitive manner.

Returns:Map<String, List<String>>

the list of headers.

getHttpSessionback to summary
public 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.

Returns:Object

the http session or 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.

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

Return the request parameters associated with the request.

Returns:Map<String, List<String>>

the unmodifiable map of the request parameters.

getQueryStringback to summary
public String getQueryString()

Return the query string associated with the request.

Returns:String

the query string.

getRequestURIback to summary
public URI getRequestURI()

Return the request URI of the handshake request.

Returns:URI

the request uri of the handshake request.

getUserPrincipalback to summary
public Principal getUserPrincipal()

Return the authenticated user or null if no user is authenticated for this handshake.

Returns:Principal

the user principal.

isUserInRoleback to summary
public boolean isUserInRole(String role)

Checks whether the current user is in the given role. Roles and role membership can be defined using deployment descriptors of the containing WAR file, if running in a Java EE web container. If the user has not been authenticated, the method returns false.

Parameters
role:String

the role being checked.

Returns:boolean

whether the authenticated user is in the role, or false if the user has not been authenticated.