Interface HandshakeRequest
public interface HandshakeRequest
Represents the HTTP request that asked to be upgraded to WebSocket.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the Sec-WebSocket-Extensions HTTP header.static final StringName of the Sec-WebSocket-Key HTTP header.static final StringName of the Sec-WebSocket-Protocol HTTP header.static final StringName of the Sec-WebSocket-Version HTTP header. -
Method Summary
Modifier and TypeMethodDescriptionReturns the HTTP headers from the handshake request.Get the HTTP Session object associated with this request.Returns the query parameters from the handshake request.Returns the query string from the handshake request.Returns the URI of the handshake request.Returns the principal of the user associated with this request, ornullif the user is not authenticated.booleanisUserInRole(String role) Returns whether the user associated with this request is in the given role.
-
Field Details
-
SEC_WEBSOCKET_KEY
-
SEC_WEBSOCKET_PROTOCOL
Name of the Sec-WebSocket-Protocol HTTP header.- See Also:
-
SEC_WEBSOCKET_VERSION
-
SEC_WEBSOCKET_EXTENSIONS
Name of the Sec-WebSocket-Extensions HTTP header.- See Also:
-
-
Method Details
-
getHeaders
-
getUserPrincipal
Principal getUserPrincipal()Returns the principal of the user associated with this request, ornullif the user is not authenticated.- Returns:
- The user principal
-
getRequestURI
-
isUserInRole
Returns whether the user associated with this request is in the given role.- Parameters:
role- The role to check- Returns:
trueif the user is in the specified role
-
getHttpSession
Object getHttpSession()Get the HTTP Session object associated with this request. Object is used to avoid a direct dependency on the Servlet API.- Returns:
- The jakarta.servlet.http.HttpSession object associated with this request, if any.
-
getParameterMap
-
getQueryString
String getQueryString()Returns the query string from the handshake request.- Returns:
- The query string
-