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)
RequestContext
complete
in interface RequestContext
trm
- (undocumented)public scala.concurrent.ExecutionContextExecutor executionContext()
RequestContext
executionContext
in interface RequestContext
public scala.concurrent.Future<RouteResult> fail(java.lang.Throwable error)
RequestContext
handleExceptions
directive and its ExceptionHandler
, unless the error is a RejectionError
. In this case the
wrapped rejection is unpacked and "executed".fail
in interface RequestContext
error
- (undocumented)public org.apache.pekko.event.LoggingAdapter log()
RequestContext
log
in interface RequestContext
public RequestContext mapRequest(scala.Function1<HttpRequest,HttpRequest> f)
RequestContext
mapRequest
in interface RequestContext
f
- (undocumented)public RequestContext mapUnmatchedPath(scala.Function1<Uri.Path,Uri.Path> f)
RequestContext
mapUnmatchedPath
in interface RequestContext
f
- (undocumented)public org.apache.pekko.stream.Materializer materializer()
RequestContext
materializer
in interface RequestContext
public ParserSettings parserSettings()
RequestContext
parserSettings
in interface RequestContext
public RequestContext reconfigure(scala.concurrent.ExecutionContextExecutor executionContext, org.apache.pekko.stream.Materializer materializer, org.apache.pekko.event.LoggingAdapter log, RoutingSettings settings)
RequestContext
reconfigure
in interface RequestContext
executionContext
- (undocumented)materializer
- (undocumented)log
- (undocumented)settings
- (undocumented)public scala.concurrent.Future<RouteResult> redirect(Uri uri, StatusCodes.Redirection redirectionType)
RequestContext
redirect
in interface RequestContext
uri
- (undocumented)redirectionType
- (undocumented)public scala.concurrent.Future<RouteResult> reject(scala.collection.immutable.Seq<Rejection> rejections)
RequestContext
reject
in interface RequestContext
rejections
- (undocumented)public HttpRequest request()
RequestContext
request
in interface RequestContext
public RoutingSettings settings()
RequestContext
settings
in interface RequestContext
public java.lang.String toString()
toString
in class java.lang.Object
public Uri.Path unmatchedPath()
RequestContext
unmatchedPath
in interface RequestContext
public RequestContext withAcceptAll()
RequestContext
withAcceptAll
in interface RequestContext
public RequestContext withExecutionContext(scala.concurrent.ExecutionContextExecutor executionContext)
RequestContext
withExecutionContext
in interface RequestContext
executionContext
- (undocumented)public RequestContext withLog(org.apache.pekko.event.LoggingAdapter log)
RequestContext
withLog
in interface RequestContext
log
- (undocumented)public RequestContext withMaterializer(org.apache.pekko.stream.Materializer materializer)
RequestContext
withMaterializer
in interface RequestContext
materializer
- (undocumented)public RequestContext withParserSettings(ParserSettings parserSettings)
RequestContext
pekko.http.scaladsl.settings.ParserSettings
.withParserSettings
in interface RequestContext
parserSettings
- (undocumented)public RequestContext withRequest(HttpRequest request)
RequestContext
withRequest
in interface RequestContext
request
- (undocumented)public RequestContext withRoutingSettings(RoutingSettings routingSettings)
RequestContext
withRoutingSettings
in interface RequestContext
routingSettings
- (undocumented)public RequestContext withUnmatchedPath(Uri.Path path)
RequestContext
withUnmatchedPath
in interface RequestContext
path
- (undocumented)