Class RequestProcessingContext
java.lang.Object
org.glassfish.jersey.server.internal.process.RequestProcessingContext
- All Implemented Interfaces:
RespondingContext
Request processing context.
Serves as a hub for all request processing related information and is being passed between stages.
- Author:
- Marek Potociar
-
Constructor Summary
ConstructorsConstructorDescriptionRequestProcessingContext(InjectionManager injectionManager, ContainerRequest request, UriRoutingContext routingContext, RequestEventBuilder monitoringEventBuilder, RequestEventListener monitoringEventListener) Create new request processing context. -
Method Summary
Modifier and TypeMethodDescriptionGet the asynchronous context associated with this request processing context.Get aValueinstance holding the asynchronous context associated with this request processing context.Get closeable service associated with the request.(Optionally) create a responder chain from all transformations previously pushed into the context.voidinitAsyncContext(Value<AsyncContext> lazyContextValue) Lazily initializeAsyncContextfor this request processing context.Get injection manager.Get request monitoring event builder.voidpush(Function<ContainerResponse, ContainerResponse> responseTransformation) Push response transformation function that should be applied.voidpush(ChainableStage<ContainerResponse> stage) Push chainable response transformation stage that should be applied.request()Get the processed container request.Get the routing context for the processed container request.voidtriggerEvent(RequestEvent.Type eventType) Trigger a new monitoring event for the currently processed request.
-
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
Get the processed container request.- Returns:
- processed container request.
-
routingContext
Get the routing context for the processed container request.- Returns:
- request routing context.
-
closeableService
Get closeable service associated with the request.- Returns:
- closeable service associated with the request.
-
initAsyncContext
Lazily initializeAsyncContextfor this request processing context.The
lazyContextValuewill be only invoked once during the first call toasyncContext(). As such, the asynchronous context for this request can be initialized lazily, on demand.- Parameters:
lazyContextValue- lazily initializedAsyncContextinstance bound to this request processing context.
-
asyncContext
Get the asynchronous context associated with this request processing context. May returnnullif no asynchronous context has been initialized in this request processing context yet.- Returns:
- asynchronous context associated with this request processing context, or
nullif the asynchronous context has not been initialized yet (seeinitAsyncContext(org.glassfish.jersey.internal.util.collection.Value)).
-
asyncContextValue
Get aValueinstance 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
Get injection manager. The returned instance is application-scoped.- Returns:
- application-scoped injection manager.
-
monitoringEventBuilder
Get request monitoring event builder.- Returns:
- request monitoring event builder.
-
triggerEvent
Trigger a new monitoring event for the currently processed request.- Parameters:
eventType- request event type.
-
push
Description copied from interface:RespondingContextPush response transformation function that should be applied.- Specified by:
pushin interfaceRespondingContext- Parameters:
responseTransformation- response transformation function.
-
push
Description copied from interface:RespondingContextPush chainable response transformation stage that should be applied.- Specified by:
pushin interfaceRespondingContext- Parameters:
stage- response transformation chainable stage.
-
createRespondingRoot
Description copied from interface:RespondingContext(Optionally) create a responder chain from all transformations previously pushed into the context.- Specified by:
createRespondingRootin interfaceRespondingContext- Returns:
- created responder chain root or
nullin case of no registered transformations.
-