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 HttpRequest as it flows through a akka-http Route structure.

    • 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 closest handleExceptions directive and its ExceptionHandler, unless the error is a RejectionError. 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)
      • 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)