Package org.glassfish.tyrus.core
Class RequestContext
- java.lang.Object
-
- org.glassfish.tyrus.spi.UpgradeRequest
-
- org.glassfish.tyrus.core.RequestContext
-
- All Implemented Interfaces:
jakarta.websocket.server.HandshakeRequest
public final class RequestContext extends UpgradeRequest
Implementation of all possible request interfaces. Should be the only point of truth.- Author:
- Pavel Bucek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRequestContext.BuilderRequestContextbuilder.
-
Field Summary
-
Fields inherited from class org.glassfish.tyrus.spi.UpgradeRequest
AUTHORIZATION, CLUSTER_CONNECTION_ID_HEADER, CONNECTION, ENABLE_TRACING_HEADER, HOST, ORIGIN_HEADER, RESPONSE_CODE_MESSAGE, SEC_WS_ORIGIN_HEADER, SERVER_KEY_HASH, TRACING_THRESHOLD, UPGRADE, WEBSOCKET
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetHeader(java.lang.String name)Returns the header value corresponding to the name.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()Get headers.java.lang.ObjectgetHttpSession()java.util.Map<java.lang.String,java.util.List<java.lang.String>>getParameterMap()java.lang.StringgetQueryString()java.lang.StringgetRemoteAddr()Get the Internet Protocol (IP) address of the client or last proxy that sent the request.java.lang.StringgetRequestUri()Get the undecoded request uri (up to the query string) of underlying HTTP handshake request.java.net.URIgetRequestURI()java.lang.StringgetServerAddr()Returns the host name of the server to which the request was sent.intgetServerPort()Get the port of the last client or proxy that sent the request.java.security.PrincipalgetUserPrincipal()booleanisSecure()Indicates whether this request was made using a secure channel (such as HTTPS).booleanisUserInRole(java.lang.String role)voidlock()Make headers and parameter map read-only.
-
-
-
Method Detail
-
getHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Get headers.- Returns:
- headers map. List items are corresponding to header declaration in HTTP request.
-
getHeader
public java.lang.String getHeader(java.lang.String name)
Returns the header value corresponding to the name.- Specified by:
getHeaderin classUpgradeRequest- Parameters:
name- header name.- Returns:
Listof header values iff found,nullotherwise.
-
lock
public void lock()
Make headers and parameter map read-only.
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
-
getRequestURI
public java.net.URI getRequestURI()
-
isUserInRole
public boolean isUserInRole(java.lang.String role)
-
getHttpSession
public java.lang.Object getHttpSession()
-
getParameterMap
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()
-
getQueryString
public java.lang.String getQueryString()
-
getRequestUri
public java.lang.String getRequestUri()
Description copied from class:UpgradeRequestGet the undecoded request uri (up to the query string) of underlying HTTP handshake request.- Specified by:
getRequestUriin classUpgradeRequest- Returns:
- request uri.
-
isSecure
public boolean isSecure()
Description copied from class:UpgradeRequestIndicates whether this request was made using a secure channel (such as HTTPS).- Specified by:
isSecurein classUpgradeRequest- Returns:
- true if the request was made using secure channel, false otherwise.
-
getRemoteAddr
public java.lang.String getRemoteAddr()
Get the Internet Protocol (IP) address of the client or last proxy that sent the request.- Returns:
- a
Stringcontaining the IP address of the client that sent the request ornullwhen method is called on client-side.
-
getServerAddr
public java.lang.String getServerAddr()
Returns the host name of the server to which the request was sent.- Returns:
- a
StringReturns the host name of the server to which the request was sent ornullwhen method is called on client-side.
-
getServerPort
public int getServerPort()
Get the port of the last client or proxy that sent the request.- Returns:
- a port of the client that sent the request.
-
-