public final class RequestProcessingContext extends Object implements RespondingContext
Constructor and Description |
---|
RequestProcessingContext(InjectionManager injectionManager,
ContainerRequest request,
UriRoutingContext routingContext,
RequestEventBuilder monitoringEventBuilder,
RequestEventListener monitoringEventListener)
Create new request processing context.
|
Modifier and Type | Method and Description |
---|---|
AsyncContext |
asyncContext()
Get the asynchronous context associated with this request processing context.
|
Value<AsyncContext> |
asyncContextValue()
Get a
Value instance holding the asynchronous context associated with this request processing context. |
CloseableService |
closeableService()
Get closeable service associated with the request.
|
Stage<ContainerResponse> |
createRespondingRoot()
(Optionally) create a responder chain from all transformations
previously pushed into the context.
|
void |
initAsyncContext(Value<AsyncContext> lazyContextValue)
Lazily initialize
AsyncContext for this
request processing context. |
InjectionManager |
injectionManager()
Get injection manager.
|
RequestEventBuilder |
monitoringEventBuilder()
Get request monitoring event builder.
|
void |
push(ChainableStage<ContainerResponse> stage)
Push chainable response transformation stage that should be applied.
|
void |
push(Function<ContainerResponse,ContainerResponse> responseTransformation)
Push response transformation function that should be applied.
|
ContainerRequest |
request()
Get the processed container request.
|
RoutingContext |
routingContext()
Get the routing context for the processed container request.
|
void |
triggerEvent(RequestEvent.Type eventType)
Trigger a new monitoring event for the currently processed request.
|
public RequestProcessingContext(InjectionManager injectionManager, ContainerRequest request, UriRoutingContext routingContext, RequestEventBuilder monitoringEventBuilder, RequestEventListener monitoringEventListener)
injectionManager
- injection manager / injector.request
- container request.routingContext
- routing context.monitoringEventBuilder
- request monitoring event builder.monitoringEventListener
- registered request monitoring event listener.public ContainerRequest request()
public RoutingContext routingContext()
public CloseableService closeableService()
public void initAsyncContext(Value<AsyncContext> lazyContextValue)
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.
lazyContextValue
- lazily initialized AsyncContext
instance bound to this request processing context.public AsyncContext asyncContext()
null
if no asynchronous context has been initialized in this request processing context yet.null
if the
asynchronous context has not been initialized yet
(see initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)
).public Value<AsyncContext> asyncContextValue()
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.initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)
).public InjectionManager injectionManager()
public RequestEventBuilder monitoringEventBuilder()
public void triggerEvent(RequestEvent.Type eventType)
eventType
- request event type.public void push(Function<ContainerResponse,ContainerResponse> responseTransformation)
RespondingContext
push
in interface RespondingContext
responseTransformation
- response transformation function.public void push(ChainableStage<ContainerResponse> stage)
RespondingContext
push
in interface RespondingContext
stage
- response transformation chainable stage.public Stage<ContainerResponse> createRespondingRoot()
RespondingContext
createRespondingRoot
in interface RespondingContext
null
in case of no
registered transformations.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.