Class RequestProcessingContext

java.lang.Object
org.glassfish.jersey.server.internal.process.RequestProcessingContext
All Implemented Interfaces:
RespondingContext

public final class RequestProcessingContext extends Object implements RespondingContext
Request processing context. Serves as a hub for all request processing related information and is being passed between stages.
Author:
Marek Potociar
  • Constructor Details

    • RequestProcessingContext

      public RequestProcessingContext(InjectionManager injectionManager, ContainerRequest request, UriRoutingContext routingContext, RequestEventBuilder monitoringEventBuilder, RequestEventListener monitoringEventListener)
      Create new request processing context.
      Parameters:
      injectionManager - injection manager / injector.
      request - container request.
      routingContext - routing context.
      monitoringEventBuilder - request monitoring event builder.
      monitoringEventListener - registered request monitoring event listener.
  • Method Details

    • request

      public ContainerRequest request()
      Get the processed container request.
      Returns:
      processed container request.
    • routingContext

      public RoutingContext routingContext()
      Get the routing context for the processed container request.
      Returns:
      request routing context.
    • closeableService

      public CloseableService closeableService()
      Get closeable service associated with the request.
      Returns:
      closeable service associated with the request.
    • initAsyncContext

      public void initAsyncContext(Value<AsyncContext> lazyContextValue)
      Lazily initialize AsyncContext for this request processing context.

      The lazyContextValue will be only invoked once during the first call to asyncContext(). As such, the asynchronous context for this request can be initialized lazily, on demand.

      Parameters:
      lazyContextValue - lazily initialized AsyncContext instance bound to this request processing context.
    • asyncContext

      public AsyncContext asyncContext()
      Get the asynchronous context associated with this request processing context. May return null if no asynchronous context has been initialized in this request processing context yet.
      Returns:
      asynchronous context associated with this request processing context, or null if the asynchronous context has not been initialized yet (see initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)).
    • asyncContextValue

      public Value<AsyncContext> asyncContextValue()
      Get a Value instance holding the asynchronous context associated with this request processing context. May return an empty value if no asynchronous context has been initialized in this request processing context yet.
      Returns:
      value instance holding the asynchronous context associated with this request processing context. The returned value may be empty, if no asynchronous context has been initialized yet (see initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)).
    • injectionManager

      public InjectionManager injectionManager()
      Get injection manager. The returned instance is application-scoped.
      Returns:
      application-scoped injection manager.
    • monitoringEventBuilder

      public RequestEventBuilder monitoringEventBuilder()
      Get request monitoring event builder.
      Returns:
      request monitoring event builder.
    • triggerEvent

      public void triggerEvent(RequestEvent.Type eventType)
      Trigger a new monitoring event for the currently processed request.
      Parameters:
      eventType - request event type.
    • push

      public void push(Function<ContainerResponse,ContainerResponse> responseTransformation)
      Description copied from interface: RespondingContext
      Push response transformation function that should be applied.
      Specified by:
      push in interface RespondingContext
      Parameters:
      responseTransformation - response transformation function.
    • push

      public void push(ChainableStage<ContainerResponse> stage)
      Description copied from interface: RespondingContext
      Push chainable response transformation stage that should be applied.
      Specified by:
      push in interface RespondingContext
      Parameters:
      stage - response transformation chainable stage.
    • createRespondingRoot

      public Stage<ContainerResponse> createRespondingRoot()
      Description copied from interface: RespondingContext
      (Optionally) create a responder chain from all transformations previously pushed into the context.
      Specified by:
      createRespondingRoot in interface RespondingContext
      Returns:
      created responder chain root or null in case of no registered transformations.