Interface RequestContext
- All Known Implementing Classes:
- RequestContextImpl
public interface RequestContext
This class is not meant to be extended by user code.
 
 Immutable object encapsulating the context of an pekko.http.scaladsl.model.HttpRequest
 as it flows through a pekko-http Route structure.
- 
Method SummaryModifier and TypeMethodDescriptionscala.concurrent.Future<RouteResult>Completes the request with the given ToResponseMarshallable.scala.concurrent.ExecutionContextExecutorThe default ExecutionContext to be used for scheduling asynchronous logic related to this request.scala.concurrent.Future<RouteResult>Bubbles the given error up the response chain where it is dealt with by the closesthandleExceptionsdirective and itsExceptionHandler, unless the error is aRejectionError.org.apache.pekko.event.LoggingAdapterlog()The default LoggingAdapter to be used for logging messages related to this request.mapRequest(scala.Function1<HttpRequest, HttpRequest> f) Returns a copy of this context with the HttpRequest transformed by the given function.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.MaterializerThe default Materializer.The default ParserSettings to be used for configuring directives.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>Rejects the request with the given rejections.request()The request this context represents.settings()The default RoutingSettings to be used for configuring directives.The unmatched path of this context.Removes a potentially existing Accept header from the request headers.withExecutionContext(scala.concurrent.ExecutionContextExecutor ec) Returns a copy of this context with the new HttpRequest.withLog(org.apache.pekko.event.LoggingAdapter log) Returns a copy of this context with the new LoggingAdapter.withMaterializer(org.apache.pekko.stream.Materializer materializer) Returns a copy of this context with the new HttpRequest.withParserSettings(ParserSettings settings) Returns a copy of this context with the newpekko.http.scaladsl.settings.ParserSettings.withRequest(HttpRequest req) Returns a copy of this context with the new HttpRequest.withRoutingSettings(RoutingSettings settings) Returns a copy of this context with the new RoutingSettings.withUnmatchedPath(Uri.Path path) Returns a copy of this context with the unmatched path updated to the given one.
- 
Method Details- 
completeCompletes the request with the given ToResponseMarshallable.- Parameters:
- obj- (undocumented)
- Returns:
- (undocumented)
 
- 
executionContextscala.concurrent.ExecutionContextExecutor executionContext()The default ExecutionContext to be used for scheduling asynchronous logic related to this request.- Returns:
- (undocumented)
 
- 
failBubbles the given error up the response chain where it is dealt with by the closesthandleExceptionsdirective and itsExceptionHandler, unless the error is aRejectionError. In this case the wrapped rejection is unpacked and "executed".- Parameters:
- error- (undocumented)
- Returns:
- (undocumented)
 
- 
logorg.apache.pekko.event.LoggingAdapter log()The default LoggingAdapter to be used for logging messages related to this request.- Returns:
- (undocumented)
 
- 
mapRequestReturns a copy of this context with the HttpRequest transformed by the given function.- Parameters:
- f- (undocumented)
- Returns:
- (undocumented)
 
- 
mapUnmatchedPathReturns a copy of this context with the unmatchedPath transformed by the given function.- Parameters:
- f- (undocumented)
- Returns:
- (undocumented)
 
- 
materializerorg.apache.pekko.stream.Materializer materializer()The default Materializer.- Returns:
- (undocumented)
 
- 
parserSettingsParserSettings parserSettings()The default ParserSettings to be used for configuring directives.- Returns:
- (undocumented)
 
- 
reconfigureRequestContext 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.- Parameters:
- executionContext- (undocumented)
- materializer- (undocumented)
- log- (undocumented)
- settings- (undocumented)
- Returns:
- (undocumented)
 
- 
redirectCompletes the request with redirection response of the given type to the given URI.- Parameters:
- uri- (undocumented)
- redirectionType- (undocumented)
- Returns:
- (undocumented)
 
- 
rejectRejects the request with the given rejections.- Parameters:
- rejections- (undocumented)
- Returns:
- (undocumented)
 
- 
requestHttpRequest request()The request this context represents. Modelled as a `val` so as to enable an `import ctx.request._`.
- 
settingsRoutingSettings settings()The default RoutingSettings to be used for configuring directives.- Returns:
- (undocumented)
 
- 
unmatchedPathUri.Path unmatchedPath()The unmatched path of this context. Modelled as a `val` so as to enable an `import ctx.unmatchedPath._`.
- 
withAcceptAllRequestContext withAcceptAll()Removes a potentially existing Accept header from the request headers.- Returns:
- (undocumented)
 
- 
withExecutionContextReturns a copy of this context with the new HttpRequest.- Parameters:
- ec- (undocumented)
- Returns:
- (undocumented)
 
- 
withLogReturns a copy of this context with the new LoggingAdapter.- Parameters:
- log- (undocumented)
- Returns:
- (undocumented)
 
- 
withMaterializerReturns a copy of this context with the new HttpRequest.- Parameters:
- materializer- (undocumented)
- Returns:
- (undocumented)
 
- 
withParserSettingsReturns a copy of this context with the newpekko.http.scaladsl.settings.ParserSettings.- Parameters:
- settings- (undocumented)
- Returns:
- (undocumented)
 
- 
withRequestReturns a copy of this context with the new HttpRequest.- Parameters:
- req- (undocumented)
- Returns:
- (undocumented)
 
- 
withRoutingSettingsReturns a copy of this context with the new RoutingSettings.- Parameters:
- settings- (undocumented)
- Returns:
- (undocumented)
 
- 
withUnmatchedPathReturns a copy of this context with the unmatched path updated to the given one.- Parameters:
- path- (undocumented)
- Returns:
- (undocumented)
 
 
-