Class ServerUpgradeRequest
java.lang.Object
org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest
Upgrade request used for websocket negotiation.
Provides getters for things like the requested extensions and subprotocols so that the headers don't have to be parsed manually.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getHeaderInt
(String name) getHeaders
(String name) getHost()
jakarta.servlet.http.HttpServletRequest
getServletAttribute
(String name) jakarta.servlet.http.HttpSession
boolean
hasSubProtocol
(String subprotocol) boolean
isSecure()
boolean
isUserInRole
(String role) void
setServletAttribute
(String name, Object value)
-
Constructor Details
-
ServerUpgradeRequest
- Throws:
BadMessageException
-
-
Method Details
-
getCertificates
- Returns:
- The
X509Certificate
instance at request attribute "jakarta.servlet.request.X509Certificate" or null.
-
getCookies
- Returns:
- Request cookies
- See Also:
-
HttpServletRequest.getCookies()
-
getExtensions
- Returns:
- The extensions offered
- See Also:
-
getHeader
- Parameters:
name
- Header name- Returns:
- Header value or null
- See Also:
-
HttpServletRequest.getHeader(String)
-
getHeaderInt
- Parameters:
name
- Header name- Returns:
- Header value as integer or -1
- See Also:
-
HttpServletRequest.getHeader(String)
-
getHeadersMap
- Returns:
- Map of headers
- See Also:
-
getHeaders
- Parameters:
name
- Header name- Returns:
- List of header values or null
- See Also:
-
getHost
- Returns:
- The requested host
- See Also:
-
HttpServletRequest.getRequestURL()
-
getHttpServletRequest
public jakarta.servlet.http.HttpServletRequest getHttpServletRequest()- Returns:
- Immutable version of
HttpServletRequest
-
getHttpVersion
- Returns:
- The HTTP protocol version
- See Also:
-
ServletRequest.getProtocol()
-
getLocale
- Returns:
- The requested Locale
- See Also:
-
ServletRequest.getLocale()
-
getLocales
- Returns:
- The requested Locales
- See Also:
-
ServletRequest.getLocales()
-
getLocalSocketAddress
- Returns:
- The local requested address, which is typically an
InetSocketAddress
, but may be another derivation ofSocketAddress
- See Also:
-
ServletRequest.getLocalAddr()
ServletRequest.getLocalPort()
-
getMethod
- Returns:
- The requested method
- See Also:
-
HttpServletRequest.getMethod()
-
getOrigin
- Returns:
- The origin header value
-
getParameterMap
- Returns:
- The request parameter map
- See Also:
-
ServletRequest.getParameterMap()
-
getProtocolVersion
- Returns:
- WebSocket protocol version from "Sec-WebSocket-Version" header
-
getQueryString
- Returns:
- The request query string
- See Also:
-
HttpServletRequest.getQueryString()
-
getRemoteSocketAddress
- Returns:
- The remote request address, which is typically an
InetSocketAddress
, but may be another derivation ofSocketAddress
- See Also:
-
ServletRequest.getRemoteAddr()
ServletRequest.getRemotePort()
-
getRequestPath
- Returns:
- The request URI path within the context
-
getRequestURI
- Returns:
- The request URI
- See Also:
-
HttpServletRequest.getRequestURL()
-
getPathInContext
- Returns:
- the path within the context, combination of the ServletPath with the PathInfo.
-
getServletAttribute
- Parameters:
name
- Attribute name- Returns:
- Attribute value or null
- See Also:
-
ServletRequest.getAttribute(String)
-
getServletAttributes
- Returns:
- Request attribute map
-
getServletParameters
- Returns:
- Request parameters
- See Also:
-
ServletRequest.getParameterMap()
-
getSession
public jakarta.servlet.http.HttpSession getSession()- Returns:
- The HttpSession, which may be null or invalidated
- See Also:
-
HttpServletRequest.getSession(boolean)
-
getSubProtocols
- Returns:
- Get WebSocket negotiation offered sub protocols
-
getUserPrincipal
- Returns:
- The User's
Principal
or null - See Also:
-
HttpServletRequest.getUserPrincipal()
-
hasSubProtocol
- Parameters:
subprotocol
- A sub protocol name- Returns:
- True if the sub protocol was offered
-
isSecure
public boolean isSecure()- Returns:
- True if the request is secure
- See Also:
-
ServletRequest.isSecure()
-
isUserInRole
- Parameters:
role
- The user role- Returns:
- True if the requests user has the role
- See Also:
-
HttpServletRequest.isUserInRole(String)
-
setServletAttribute
- Parameters:
name
- Attribute namevalue
- Attribute value to set- See Also:
-
ServletRequest.setAttribute(String, Object)
-