Package akka.http.scaladsl.server
Interface RequestContext
-
- All Known Implementing Classes:
RequestContextImpl
public interface RequestContextThis class is not meant to be extended by user code.Immutable object encapsulating the context of an
HttpRequestas it flows through a akka-http Route structure.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description scala.concurrent.Future<RouteResult>complete(ToResponseMarshallable obj)Completes the request with the given ToResponseMarshallable.scala.concurrent.ExecutionContextExecutorexecutionContext()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 closesthandleExceptionsdirective and itsExceptionHandler, unless the error is aRejectionError.akka.event.LoggingAdapterlog()The default LoggingAdapter to be used for logging messages related to this request.RequestContextmapRequest(scala.Function1<HttpRequest,HttpRequest> f)Returns a copy of this context with the HttpRequest transformed by the given function.RequestContextmapUnmatchedPath(scala.Function1<Uri.Path,Uri.Path> f)Returns a copy of this context with the unmatchedPath transformed by the given function.akka.stream.Materializermaterializer()The default Materializer.ParserSettingsparserSettings()The default ParserSettings to be used for configuring directives.RequestContextreconfigure(scala.concurrent.ExecutionContextExecutor executionContext, akka.stream.Materializer materializer, akka.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.HttpRequestrequest()The request this context represents.RoutingSettingssettings()The default RoutingSettings to be used for configuring directives.Uri.PathunmatchedPath()The unmatched path of this context.RequestContextwithAcceptAll()Removes a potentially existing Accept header from the request headers.RequestContextwithExecutionContext(scala.concurrent.ExecutionContextExecutor ec)Returns a copy of this context with the new HttpRequest.RequestContextwithLog(akka.event.LoggingAdapter log)Returns a copy of this context with the new LoggingAdapter.RequestContextwithMaterializer(akka.stream.Materializer materializer)Returns a copy of this context with the new HttpRequest.RequestContextwithParserSettings(ParserSettings settings)Returns a copy of this context with the newParserSettings.RequestContextwithRequest(HttpRequest req)Returns a copy of this context with the new HttpRequest.RequestContextwithRoutingSettings(RoutingSettings settings)Returns a copy of this context with the new RoutingSettings.RequestContextwithUnmatchedPath(Uri.Path path)Returns a copy of this context with the unmatched path updated to the given one.
-
-
-
Method Detail
-
complete
scala.concurrent.Future<RouteResult> complete(ToResponseMarshallable obj)
Completes the request with the given ToResponseMarshallable.- Parameters:
obj- (undocumented)- Returns:
- (undocumented)
-
executionContext
scala.concurrent.ExecutionContextExecutor executionContext()
The default ExecutionContext to be used for scheduling asynchronous logic related to this request.- Returns:
- (undocumented)
-
fail
scala.concurrent.Future<RouteResult> fail(java.lang.Throwable error)
Bubbles 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)
-
log
akka.event.LoggingAdapter log()
The default LoggingAdapter to be used for logging messages related to this request.- Returns:
- (undocumented)
-
mapRequest
RequestContext mapRequest(scala.Function1<HttpRequest,HttpRequest> f)
Returns a copy of this context with the HttpRequest transformed by the given function.- Parameters:
f- (undocumented)- Returns:
- (undocumented)
-
mapUnmatchedPath
RequestContext mapUnmatchedPath(scala.Function1<Uri.Path,Uri.Path> f)
Returns a copy of this context with the unmatchedPath transformed by the given function.- Parameters:
f- (undocumented)- Returns:
- (undocumented)
-
materializer
akka.stream.Materializer materializer()
The default Materializer.- Returns:
- (undocumented)
-
parserSettings
ParserSettings parserSettings()
The default ParserSettings to be used for configuring directives.- Returns:
- (undocumented)
-
reconfigure
RequestContext reconfigure(scala.concurrent.ExecutionContextExecutor executionContext, akka.stream.Materializer materializer, akka.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)
-
redirect
scala.concurrent.Future<RouteResult> redirect(Uri uri, StatusCodes.Redirection redirectionType)
Completes the request with redirection response of the given type to the given URI.- Parameters:
uri- (undocumented)redirectionType- (undocumented)- Returns:
- (undocumented)
-
reject
scala.concurrent.Future<RouteResult> reject(scala.collection.immutable.Seq<Rejection> rejections)
Rejects the request with the given rejections.- Parameters:
rejections- (undocumented)- Returns:
- (undocumented)
-
request
HttpRequest request()
The request this context represents. Modelled as a `val` so as to enable an `import ctx.request._`.
-
settings
RoutingSettings settings()
The default RoutingSettings to be used for configuring directives.- Returns:
- (undocumented)
-
unmatchedPath
Uri.Path unmatchedPath()
The unmatched path of this context. Modelled as a `val` so as to enable an `import ctx.unmatchedPath._`.
-
withAcceptAll
RequestContext withAcceptAll()
Removes a potentially existing Accept header from the request headers.- Returns:
- (undocumented)
-
withExecutionContext
RequestContext withExecutionContext(scala.concurrent.ExecutionContextExecutor ec)
Returns a copy of this context with the new HttpRequest.- Parameters:
ec- (undocumented)- Returns:
- (undocumented)
-
withLog
RequestContext withLog(akka.event.LoggingAdapter log)
Returns a copy of this context with the new LoggingAdapter.- Parameters:
log- (undocumented)- Returns:
- (undocumented)
-
withMaterializer
RequestContext withMaterializer(akka.stream.Materializer materializer)
Returns a copy of this context with the new HttpRequest.- Parameters:
materializer- (undocumented)- Returns:
- (undocumented)
-
withParserSettings
RequestContext withParserSettings(ParserSettings settings)
Returns a copy of this context with the newParserSettings.- Parameters:
settings- (undocumented)- Returns:
- (undocumented)
-
withRequest
RequestContext withRequest(HttpRequest req)
Returns a copy of this context with the new HttpRequest.- Parameters:
req- (undocumented)- Returns:
- (undocumented)
-
withRoutingSettings
RequestContext withRoutingSettings(RoutingSettings settings)
Returns a copy of this context with the new RoutingSettings.- Parameters:
settings- (undocumented)- Returns:
- (undocumented)
-
withUnmatchedPath
RequestContext withUnmatchedPath(Uri.Path path)
Returns a copy of this context with the unmatched path updated to the given one.- Parameters:
path- (undocumented)- Returns:
- (undocumented)
-
-