Interface RequestContext
- All Superinterfaces:
Context
Provides access to request metadata including headers, query parameters, authentication information, and tracing capabilities for HTTP endpoint methods. This context is available during the processing of HTTP requests and provides essential information for request handling.
Access Methods:
- Extend
AbstractHttpEndpoint
and userequestContext()
- Inject as constructor parameter into HTTP endpoint classes
Request Headers: Access HTTP headers via requestHeader(String)
for
specific headers or allRequestHeaders()
for all headers. Header names are
case-insensitive.
Query Parameters: Use queryParams()
to access URL query parameters
with type-safe getters for common types like strings, integers, and booleans.
Authentication invalid input: '&' Authorization: Use getPrincipals()
and getJwtClaims()
to access authentication information for custom authorization logic. HTTP
endpoints support ACL annotations and JWT validation.
Tracing: Access custom tracing capabilities via tracing()
for
observability and debugging.
Not for user extension, implementation provided by the SDK.
-
Method Summary
Modifier and TypeMethodDescriptionList
<akka.http.javadsl.model.HttpHeader> Get the principals associated with this request.Optional
<akka.http.javadsl.model.HttpHeader> requestHeader
(String headerName) tracing()
Access to tracing for custom app specific tracing.Methods inherited from interface akka.javasdk.Context
selfRegion
-
Method Details
-
getPrincipals
Principals getPrincipals()Get the principals associated with this request.- Returns:
- The principals associated with this request.
-
getJwtClaims
JwtClaims getJwtClaims()- Returns:
- The JWT claims, if any, associated with this request.
-
requestHeader
- Returns:
- A header with the given name (case ignored) if present in the current request, Optional.empty() if not.
-
allRequestHeaders
List<akka.http.javadsl.model.HttpHeader> allRequestHeaders()- Returns:
- A list with all the headers of the current request
-
tracing
Tracing tracing()Access to tracing for custom app specific tracing. -
queryParams
QueryParams queryParams()- Returns:
- The query parameters of the current request.
-