Package javax.websocket.server
Interface HandshakeRequest
public interface HandshakeRequest
The handshake request represents the web socket defined Http GET request for the opening handshake of a web socket
session.
- Author:
- dannycoward
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSEC_WEBSOCKET_EXTENSIONSThe Sec-WebSocket-Extensions header namestatic java.lang.StringSEC_WEBSOCKET_KEYThe Sec-WebSocket-Key header namestatic java.lang.StringSEC_WEBSOCKET_PROTOCOLThe Sec-WebSocket-Protocol header namestatic java.lang.StringSEC_WEBSOCKET_VERSIONThe Sec-WebSocket-Version header name -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()Return the read only Map of Http Headers that came with the handshake request.java.lang.ObjectgetHttpSession()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.StringgetQueryString()Return the query string associated with the request.java.net.URIgetRequestURI()Return the request URI of the handshake request.java.security.PrincipalgetUserPrincipal()Return the authenticated user ornullif no user is authenticated for this handshake.booleanisUserInRole(java.lang.String role)Checks whether the current user is in the given role.
-
Field Details
-
SEC_WEBSOCKET_KEY
static final java.lang.String SEC_WEBSOCKET_KEYThe Sec-WebSocket-Key header name- See Also:
- Constant Field Values
-
SEC_WEBSOCKET_PROTOCOL
static final java.lang.String SEC_WEBSOCKET_PROTOCOLThe Sec-WebSocket-Protocol header name- See Also:
- Constant Field Values
-
SEC_WEBSOCKET_VERSION
static final java.lang.String SEC_WEBSOCKET_VERSIONThe Sec-WebSocket-Version header name- See Also:
- Constant Field Values
-
SEC_WEBSOCKET_EXTENSIONS
static final java.lang.String SEC_WEBSOCKET_EXTENSIONSThe Sec-WebSocket-Extensions header name- See Also:
- Constant Field Values
-
-
Method Details
-
getHeaders
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()Return the read only Map of Http Headers that came with the handshake request. The header names are case insensitive.- Returns:
- the list of headers.
-
getUserPrincipal
java.security.Principal getUserPrincipal()Return the authenticated user ornullif no user is authenticated for this handshake.- Returns:
- the user principal.
-
getRequestURI
java.net.URI getRequestURI()Return the request URI of the handshake request.- Returns:
- the request uri of the handshake request.
-
isUserInRole
boolean isUserInRole(java.lang.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 returnsfalse.- Parameters:
role- the role being checked.- Returns:
- whether the authenticated user is in the role, or false if the user has not been authenticated.
-
getHttpSession
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.- Returns:
- the http session or
nullif either the websocket implementation is not part of a Java EE web container, or there is no HttpSession associated with the opening handshake request.
-
getParameterMap
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()Return the request parameters associated with the request.- Returns:
- the unmodifiable map of the request parameters.
-
getQueryString
java.lang.String getQueryString()Return the query string associated with the request.- Returns:
- the query string.
-