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
ConstructorDescriptionRequestProcessingContext
(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 aValue
instance 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.void
initAsyncContext
(Value<AsyncContext> lazyContextValue) Lazily initializeAsyncContext
for this request processing context.Get injection manager.Get request monitoring event builder.void
push
(Function<ContainerResponse, ContainerResponse> responseTransformation) Push response transformation function that should be applied.void
push
(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.void
triggerEvent
(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 initializeAsyncContext
for this request processing context.The
lazyContextValue
will 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 initializedAsyncContext
instance bound to this request processing context.
-
asyncContext
Get the asynchronous context associated with this request processing context. May returnnull
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 (seeinitAsyncContext(org.glassfish.jersey.internal.util.collection.Value)
).
-
asyncContextValue
Get aValue
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
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:RespondingContext
Push response transformation function that should be applied.- Specified by:
push
in interfaceRespondingContext
- Parameters:
responseTransformation
- response transformation function.
-
push
Description copied from interface:RespondingContext
Push chainable response transformation stage that should be applied.- Specified by:
push
in 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:
createRespondingRoot
in interfaceRespondingContext
- Returns:
- created responder chain root or
null
in case of no registered transformations.
-