Class WsHandshakeRequest
- java.lang.Object
-
- org.apache.tomcat.websocket.server.WsHandshakeRequest
-
- All Implemented Interfaces:
HandshakeRequest
public class WsHandshakeRequest extends java.lang.Object implements HandshakeRequest
Represents the request that this session was opened under.
-
-
Field Summary
-
Fields inherited from interface jakarta.websocket.server.HandshakeRequest
SEC_WEBSOCKET_EXTENSIONS, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION
-
-
Constructor Summary
Constructors Constructor Description WsHandshakeRequest(HttpServletRequest request, java.util.Map<java.lang.String,java.lang.String> pathParams)Constructs a new WsHandshakeRequest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()Returns the HTTP headers from the handshake request.java.lang.ObjectgetHttpSession()Get the HTTP Session object associated with this request.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getParameterMap()Returns the query parameters from the handshake request.java.lang.StringgetQueryString()Returns the query string from the handshake request.java.net.URIgetRequestURI()Returns the URI of the handshake request.java.security.PrincipalgetUserPrincipal()Returns the principal of the user associated with this request, ornullif the user is not authenticated.booleanisUserInRole(java.lang.String role)Returns whether the user associated with this request is in the given role.
-
-
-
Constructor Detail
-
WsHandshakeRequest
public WsHandshakeRequest(HttpServletRequest request, java.util.Map<java.lang.String,java.lang.String> pathParams)
Constructs a new WsHandshakeRequest.- Parameters:
request- The HTTP servlet requestpathParams- The path parameters
-
-
Method Detail
-
getRequestURI
public java.net.URI getRequestURI()
Description copied from interface:jakarta.websocket.server.HandshakeRequestReturns the URI of the handshake request.- Specified by:
getRequestURIin interfaceHandshakeRequest- Returns:
- The request URI
-
getParameterMap
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()
Description copied from interface:jakarta.websocket.server.HandshakeRequestReturns the query parameters from the handshake request.- Specified by:
getParameterMapin interfaceHandshakeRequest- Returns:
- The query parameter map
-
getQueryString
public java.lang.String getQueryString()
Description copied from interface:jakarta.websocket.server.HandshakeRequestReturns the query string from the handshake request.- Specified by:
getQueryStringin interfaceHandshakeRequest- Returns:
- The query string
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
Description copied from interface:jakarta.websocket.server.HandshakeRequestReturns the principal of the user associated with this request, ornullif the user is not authenticated.- Specified by:
getUserPrincipalin interfaceHandshakeRequest- Returns:
- The user principal
-
getHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Description copied from interface:jakarta.websocket.server.HandshakeRequestReturns the HTTP headers from the handshake request.- Specified by:
getHeadersin interfaceHandshakeRequest- Returns:
- The HTTP headers
-
isUserInRole
public boolean isUserInRole(java.lang.String role)
Description copied from interface:jakarta.websocket.server.HandshakeRequestReturns whether the user associated with this request is in the given role.- Specified by:
isUserInRolein interfaceHandshakeRequest- Parameters:
role- The role to check- Returns:
trueif the user is in the specified role
-
getHttpSession
public java.lang.Object getHttpSession()
Description copied from interface:jakarta.websocket.server.HandshakeRequestGet the HTTP Session object associated with this request. Object is used to avoid a direct dependency on the Servlet API.- Specified by:
getHttpSessionin interfaceHandshakeRequest- Returns:
- The jakarta.servlet.http.HttpSession object associated with this request, if any.
-
-