public final class RequestProcessingContext extends java.lang.Object implements RespondingContext
Modifier and Type | Field and Description |
---|---|
private Ref<Value<AsyncContext>> |
asyncContextValueRef |
private CloseableService |
closeableService |
private RequestEventBuilder |
monitoringEventBuilder |
private RequestEventListener |
monitoringEventListener |
private ContainerRequest |
request |
private RespondingContext |
respondingContext |
private UriRoutingContext |
routingContext |
private org.glassfish.hk2.api.ServiceLocator |
serviceLocator |
Constructor and Description |
---|
RequestProcessingContext(org.glassfish.hk2.api.ServiceLocator serviceLocator,
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. |
RequestEventBuilder |
monitoringEventBuilder()
Get request monitoring event builder.
|
void |
push(ChainableStage<ContainerResponse> stage)
Push chainable response transformation stage that should be applied.
|
void |
push(com.google.common.base.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.
|
org.glassfish.hk2.api.ServiceLocator |
serviceLocator()
Get service locator.
|
void |
triggerEvent(RequestEvent.Type eventType)
Trigger a new monitoring event for the currently processed request.
|
(package private) UriRoutingContext |
uriRoutingContext()
Get the underlying
UriRoutingContext instance for the processed
container request. |
private final org.glassfish.hk2.api.ServiceLocator serviceLocator
private final ContainerRequest request
private final UriRoutingContext routingContext
private final RespondingContext respondingContext
private final CloseableService closeableService
private final RequestEventBuilder monitoringEventBuilder
private final RequestEventListener monitoringEventListener
private final Ref<Value<AsyncContext>> asyncContextValueRef
public RequestProcessingContext(org.glassfish.hk2.api.ServiceLocator serviceLocator, ContainerRequest request, UriRoutingContext routingContext, RequestEventBuilder monitoringEventBuilder, RequestEventListener monitoringEventListener)
serviceLocator
- service locator / injector.request
- container request.routingContext
- routing context.monitoringEventBuilder
- request monitoring event builder.monitoringEventListener
- registered request monitoring event listener.public ContainerRequest request()
public RoutingContext routingContext()
UriRoutingContext uriRoutingContext()
UriRoutingContext
instance for the processed
container request.
This instance is used by ServerProcessingBinder
to satisfy injection of multiple types, namely:
UriInfo
ExtendedUriInfo
ResourceInfo
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 org.glassfish.hk2.api.ServiceLocator serviceLocator()
public RequestEventBuilder monitoringEventBuilder()
public void triggerEvent(RequestEvent.Type eventType)
eventType
- request event type.public void push(com.google.common.base.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.