public class RequestContextImpl extends java.lang.Object implements RequestContext
| Constructor and Description |
|---|
RequestContextImpl(HttpRequest request,
org.apache.pekko.event.LoggingAdapter log,
RoutingSettings settings,
ParserSettings parserSettings,
scala.concurrent.ExecutionContextExecutor ec,
org.apache.pekko.stream.Materializer materializer) |
RequestContextImpl(HttpRequest request,
Uri.Path unmatchedPath,
scala.concurrent.ExecutionContextExecutor executionContext,
org.apache.pekko.stream.Materializer materializer,
org.apache.pekko.event.LoggingAdapter log,
RoutingSettings settings,
ParserSettings parserSettings) |
| Modifier and Type | Method and Description |
|---|---|
scala.concurrent.Future<RouteResult> |
complete(ToResponseMarshallable trm)
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.
|
java.lang.String |
toString() |
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 executionContext)
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 parserSettings)
Returns a copy of this context with the new
pekko.http.scaladsl.settings.ParserSettings. |
RequestContext |
withRequest(HttpRequest request)
Returns a copy of this context with the new HttpRequest.
|
RequestContext |
withRoutingSettings(RoutingSettings routingSettings)
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.
|
public RequestContextImpl(HttpRequest request, Uri.Path unmatchedPath, scala.concurrent.ExecutionContextExecutor executionContext, org.apache.pekko.stream.Materializer materializer, org.apache.pekko.event.LoggingAdapter log, RoutingSettings settings, ParserSettings parserSettings)
public RequestContextImpl(HttpRequest request, org.apache.pekko.event.LoggingAdapter log, RoutingSettings settings, ParserSettings parserSettings, scala.concurrent.ExecutionContextExecutor ec, org.apache.pekko.stream.Materializer materializer)
public scala.concurrent.Future<RouteResult> complete(ToResponseMarshallable trm)
RequestContextcomplete in interface RequestContexttrm - (undocumented)public scala.concurrent.ExecutionContextExecutor executionContext()
RequestContextexecutionContext in interface RequestContextpublic scala.concurrent.Future<RouteResult> fail(java.lang.Throwable error)
RequestContexthandleExceptions
directive and its ExceptionHandler, unless the error is a RejectionError. In this case the
wrapped rejection is unpacked and "executed".fail in interface RequestContexterror - (undocumented)public org.apache.pekko.event.LoggingAdapter log()
RequestContextlog in interface RequestContextpublic RequestContext mapRequest(scala.Function1<HttpRequest,HttpRequest> f)
RequestContextmapRequest in interface RequestContextf - (undocumented)public RequestContext mapUnmatchedPath(scala.Function1<Uri.Path,Uri.Path> f)
RequestContextmapUnmatchedPath in interface RequestContextf - (undocumented)public org.apache.pekko.stream.Materializer materializer()
RequestContextmaterializer in interface RequestContextpublic ParserSettings parserSettings()
RequestContextparserSettings in interface RequestContextpublic RequestContext reconfigure(scala.concurrent.ExecutionContextExecutor executionContext, org.apache.pekko.stream.Materializer materializer, org.apache.pekko.event.LoggingAdapter log, RoutingSettings settings)
RequestContextreconfigure in interface RequestContextexecutionContext - (undocumented)materializer - (undocumented)log - (undocumented)settings - (undocumented)public scala.concurrent.Future<RouteResult> redirect(Uri uri, StatusCodes.Redirection redirectionType)
RequestContextredirect in interface RequestContexturi - (undocumented)redirectionType - (undocumented)public scala.concurrent.Future<RouteResult> reject(scala.collection.immutable.Seq<Rejection> rejections)
RequestContextreject in interface RequestContextrejections - (undocumented)public HttpRequest request()
RequestContextrequest in interface RequestContextpublic RoutingSettings settings()
RequestContextsettings in interface RequestContextpublic java.lang.String toString()
toString in class java.lang.Objectpublic Uri.Path unmatchedPath()
RequestContextunmatchedPath in interface RequestContextpublic RequestContext withAcceptAll()
RequestContextwithAcceptAll in interface RequestContextpublic RequestContext withExecutionContext(scala.concurrent.ExecutionContextExecutor executionContext)
RequestContextwithExecutionContext in interface RequestContextexecutionContext - (undocumented)public RequestContext withLog(org.apache.pekko.event.LoggingAdapter log)
RequestContextwithLog in interface RequestContextlog - (undocumented)public RequestContext withMaterializer(org.apache.pekko.stream.Materializer materializer)
RequestContextwithMaterializer in interface RequestContextmaterializer - (undocumented)public RequestContext withParserSettings(ParserSettings parserSettings)
RequestContextpekko.http.scaladsl.settings.ParserSettings.withParserSettings in interface RequestContextparserSettings - (undocumented)public RequestContext withRequest(HttpRequest request)
RequestContextwithRequest in interface RequestContextrequest - (undocumented)public RequestContext withRoutingSettings(RoutingSettings routingSettings)
RequestContextwithRoutingSettings in interface RequestContextroutingSettings - (undocumented)public RequestContext withUnmatchedPath(Uri.Path path)
RequestContextwithUnmatchedPath in interface RequestContextpath - (undocumented)