public interface RequestContext
Immutable object encapsulating the context of an pekko.http.scaladsl.model.HttpRequest
as it flows through a pekko-http Route structure.
Modifier and Type | Method and Description |
---|---|
scala.concurrent.Future<RouteResult> |
complete(ToResponseMarshallable obj)
Completes the request with the given ToResponseMarshallable.
|
scala.concurrent.ExecutionContextExecutor |
executionContext()
The default ExecutionContext to be used for scheduling asynchronous logic related to this request.
|
scala.concurrent.Future<RouteResult> |
fail(java.lang.Throwable error)
Bubbles the given error up the response chain where it is dealt with by the closest
handleExceptions
directive and its ExceptionHandler , unless the error is a RejectionError . |
org.apache.pekko.event.LoggingAdapter |
log()
The default LoggingAdapter to be used for logging messages related to this request.
|
RequestContext |
mapRequest(scala.Function1<HttpRequest,HttpRequest> f)
Returns a copy of this context with the HttpRequest transformed by the given function.
|
RequestContext |
mapUnmatchedPath(scala.Function1<Uri.Path,Uri.Path> f)
Returns a copy of this context with the unmatchedPath transformed by the given function.
|
org.apache.pekko.stream.Materializer |
materializer()
The default Materializer.
|
ParserSettings |
parserSettings()
The default ParserSettings to be used for configuring directives.
|
RequestContext |
reconfigure(scala.concurrent.ExecutionContextExecutor executionContext,
org.apache.pekko.stream.Materializer materializer,
org.apache.pekko.event.LoggingAdapter log,
RoutingSettings settings)
Returns a copy of this context with the given fields updated.
|
scala.concurrent.Future<RouteResult> |
redirect(Uri uri,
StatusCodes.Redirection redirectionType)
Completes the request with redirection response of the given type to the given URI.
|
scala.concurrent.Future<RouteResult> |
reject(scala.collection.immutable.Seq<Rejection> rejections)
Rejects the request with the given rejections.
|
HttpRequest |
request()
The request this context represents.
|
RoutingSettings |
settings()
The default RoutingSettings to be used for configuring directives.
|
Uri.Path |
unmatchedPath()
The unmatched path of this context.
|
RequestContext |
withAcceptAll()
Removes a potentially existing Accept header from the request headers.
|
RequestContext |
withExecutionContext(scala.concurrent.ExecutionContextExecutor ec)
Returns a copy of this context with the new HttpRequest.
|
RequestContext |
withLog(org.apache.pekko.event.LoggingAdapter log)
Returns a copy of this context with the new LoggingAdapter.
|
RequestContext |
withMaterializer(org.apache.pekko.stream.Materializer materializer)
Returns a copy of this context with the new HttpRequest.
|
RequestContext |
withParserSettings(ParserSettings settings)
Returns a copy of this context with the new
pekko.http.scaladsl.settings.ParserSettings . |
RequestContext |
withRequest(HttpRequest req)
Returns a copy of this context with the new HttpRequest.
|
RequestContext |
withRoutingSettings(RoutingSettings settings)
Returns a copy of this context with the new RoutingSettings.
|
RequestContext |
withUnmatchedPath(Uri.Path path)
Returns a copy of this context with the unmatched path updated to the given one.
|
scala.concurrent.Future<RouteResult> complete(ToResponseMarshallable obj)
obj
- (undocumented)scala.concurrent.ExecutionContextExecutor executionContext()
scala.concurrent.Future<RouteResult> fail(java.lang.Throwable error)
handleExceptions
directive and its ExceptionHandler
, unless the error is a RejectionError
. In this case the
wrapped rejection is unpacked and "executed".error
- (undocumented)org.apache.pekko.event.LoggingAdapter log()
RequestContext mapRequest(scala.Function1<HttpRequest,HttpRequest> f)
f
- (undocumented)RequestContext mapUnmatchedPath(scala.Function1<Uri.Path,Uri.Path> f)
f
- (undocumented)org.apache.pekko.stream.Materializer materializer()
ParserSettings parserSettings()
RequestContext reconfigure(scala.concurrent.ExecutionContextExecutor executionContext, org.apache.pekko.stream.Materializer materializer, org.apache.pekko.event.LoggingAdapter log, RoutingSettings settings)
executionContext
- (undocumented)materializer
- (undocumented)log
- (undocumented)settings
- (undocumented)scala.concurrent.Future<RouteResult> redirect(Uri uri, StatusCodes.Redirection redirectionType)
uri
- (undocumented)redirectionType
- (undocumented)scala.concurrent.Future<RouteResult> reject(scala.collection.immutable.Seq<Rejection> rejections)
rejections
- (undocumented)HttpRequest request()
RoutingSettings settings()
Uri.Path unmatchedPath()
RequestContext withAcceptAll()
RequestContext withExecutionContext(scala.concurrent.ExecutionContextExecutor ec)
ec
- (undocumented)RequestContext withLog(org.apache.pekko.event.LoggingAdapter log)
log
- (undocumented)RequestContext withMaterializer(org.apache.pekko.stream.Materializer materializer)
materializer
- (undocumented)RequestContext withParserSettings(ParserSettings settings)
pekko.http.scaladsl.settings.ParserSettings
.settings
- (undocumented)RequestContext withRequest(HttpRequest req)
req
- (undocumented)RequestContext withRoutingSettings(RoutingSettings settings)
settings
- (undocumented)RequestContext withUnmatchedPath(Uri.Path path)
path
- (undocumented)