Interface HandshakeRequest


public interface HandshakeRequest
Represents the HTTP request that asked to be upgraded to WebSocket.
  • Field Details

    • SEC_WEBSOCKET_KEY

      static final String SEC_WEBSOCKET_KEY
      Name of the Sec-WebSocket-Key HTTP header.
      See Also:
    • SEC_WEBSOCKET_PROTOCOL

      static final String SEC_WEBSOCKET_PROTOCOL
      Name of the Sec-WebSocket-Protocol HTTP header.
      See Also:
    • SEC_WEBSOCKET_VERSION

      static final String SEC_WEBSOCKET_VERSION
      Name of the Sec-WebSocket-Version HTTP header.
      See Also:
    • SEC_WEBSOCKET_EXTENSIONS

      static final String SEC_WEBSOCKET_EXTENSIONS
      Name of the Sec-WebSocket-Extensions HTTP header.
      See Also:
  • Method Details

    • getHeaders

      Map<String, List<String>> getHeaders()
      Returns the HTTP headers from the handshake request.
      Returns:
      The HTTP headers
    • getUserPrincipal

      Principal getUserPrincipal()
      Returns the principal of the user associated with this request, or null if the user is not authenticated.
      Returns:
      The user principal
    • getRequestURI

      URI getRequestURI()
      Returns the URI of the handshake request.
      Returns:
      The request URI
    • isUserInRole

      boolean isUserInRole(String role)
      Returns whether the user associated with this request is in the given role.
      Parameters:
      role - The role to check
      Returns:
      true if 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

      Map<String, List<String>> getParameterMap()
      Returns the query parameters from the handshake request.
      Returns:
      The query parameter map
    • getQueryString

      String getQueryString()
      Returns the query string from the handshake request.
      Returns:
      The query string