public interface RequestEvent
RequestEventListener
(javadoc of listener describes how to register the listener for
particular request).
The event contains the RequestEvent.Type
which distinguishes between types of event. There are various
properties in the event (accessible by getters) and some of them might be relevant only to specific event types.
Note that internal state of the event must be modified. Even the event is immutable it exposes objects
which might be mutable and the code of event listener must not change state of these objects.Modifier and Type | Interface and Description |
---|---|
static class |
RequestEvent.ExceptionCause
Describes the origin of the exception.
|
static class |
RequestEvent.Type
The type of the event which describes in which request processing phase the event
is triggered.
|
Modifier and Type | Method and Description |
---|---|
ContainerRequest |
getContainerRequest()
Get the container request.
|
Iterable<ContainerRequestFilter> |
getContainerRequestFilters()
Get
container request filters used during the request filtering
phase. |
ContainerResponse |
getContainerResponse()
Get the container response.
|
Iterable<ContainerResponseFilter> |
getContainerResponseFilters()
Get
container response filters used during the response filtering
phase. |
Throwable |
getException()
Get the latest exception, if any, thrown by the request and response processing.
|
RequestEvent.ExceptionCause |
getExceptionCause()
Get the
exception cause . |
ExceptionMapper<?> |
getExceptionMapper()
Get the
ExceptionMapper that was found and used during the exception mapping phase. |
RequestEvent.Type |
getType()
Returns the
type of this event. |
ExtendedUriInfo |
getUriInfo()
Get the
extended uri info associated with this request. |
boolean |
isResponseSuccessfullyMapped()
Returns
true if the response was successfully mapped from an exception
by exception mappers . |
boolean |
isResponseWritten()
Returns
true if the response has been successfully written. |
boolean |
isSuccess()
Return
true if the request and response has been successfully processed. |
RequestEvent.Type getType()
type
of this event.ContainerRequest getContainerRequest()
request event listener
.ContainerResponse getContainerResponse()
event types
. The
returned response might vary also on the event type. The getter returns always the latest response being
processed. So, for example for event RequestEvent.Type.EXCEPTION_MAPPING_FINISHED
event type the method
returns mapped response and not the original response created from execution of the resource method.null
if no response has been produced yet.Throwable getException()
getExceptionCause()
returns the origin of the exception.null
if no exception has been thrown.ExtendedUriInfo getUriInfo()
extended uri info
associated with this request. This method returns
null for RequestEvent.Type.START
event. The returned ExtendedUriInfo
can be used to retrieve
information relevant to many event types (especially event types describing the matching process).null
if it is not available yet.ExceptionMapper<?> getExceptionMapper()
ExceptionMapper
that was found and used during the exception mapping phase.null
if no exception mapper was found or even needed.Iterable<ContainerRequestFilter> getContainerRequestFilters()
container request filters
used during the request filtering
phase.null
if no filters were used yet.Iterable<ContainerResponseFilter> getContainerResponseFilters()
container response filters
used during the response filtering
phase.null
if no filters were used yet.boolean isSuccess()
true
if the request and response has been successfully processed. Response is successfully
processed when the response code is smaller than 400 and response was successfully written. If the exception
occurred but was mapped into a response with successful response code and written, this method returns
true
.boolean isResponseSuccessfullyMapped()
true
if the response was successfully mapped from an exception
by exception mappers
. When exception mapping phase failed or when
no exception was thrown at all the, the method returns false. This method is convenient when
handling the RequestEvent.Type.EXCEPTION_MAPPING_FINISHED
event type.RequestEvent.ExceptionCause getExceptionCause()
exception cause
. This method is relevant only in cases when
getException()
returns non-null value (for example when handling RequestEvent.Type.ON_EXCEPTION
)
event type.null
if no exception has occurred.boolean isResponseWritten()
true
if the response has been successfully written. true
is returned
even for cases when the written response contains error response code.true
if the response was successfully written;false
when the response
has not been written yet or when writing of response failed.Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.