public class RequestEventImpl extends Object implements RequestEvent
Request event
implementation. Instances are immutable.Modifier and Type | Class and Description |
---|---|
static class |
RequestEventImpl.Builder
Builder of
RequestEventImpl . |
RequestEvent.ExceptionCause, RequestEvent.Type
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. |
public ContainerRequest getContainerRequest()
RequestEvent
request event listener
.getContainerRequest
in interface RequestEvent
public ContainerResponse getContainerResponse()
RequestEvent
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.getContainerResponse
in interface RequestEvent
null
if no response has been produced yet.public Throwable getException()
RequestEvent
RequestEvent.getExceptionCause()
returns the origin of the exception.getException
in interface RequestEvent
null
if no exception has been thrown.public RequestEvent.Type getType()
RequestEvent
type
of this event.getType
in interface RequestEvent
public ExtendedUriInfo getUriInfo()
RequestEvent
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).getUriInfo
in interface RequestEvent
null
if it is not available yet.public ExceptionMapper<?> getExceptionMapper()
RequestEvent
ExceptionMapper
that was found and used during the exception mapping phase.getExceptionMapper
in interface RequestEvent
null
if no exception mapper was found or even needed.public Iterable<ContainerRequestFilter> getContainerRequestFilters()
RequestEvent
container request filters
used during the request filtering
phase.getContainerRequestFilters
in interface RequestEvent
null
if no filters were used yet.public Iterable<ContainerResponseFilter> getContainerResponseFilters()
RequestEvent
container response filters
used during the response filtering
phase.getContainerResponseFilters
in interface RequestEvent
null
if no filters were used yet.public boolean isSuccess()
RequestEvent
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
.isSuccess
in interface RequestEvent
public boolean isResponseSuccessfullyMapped()
RequestEvent
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.isResponseSuccessfullyMapped
in interface RequestEvent
public RequestEvent.ExceptionCause getExceptionCause()
RequestEvent
exception cause
. This method is relevant only in cases when
RequestEvent.getException()
returns non-null value (for example when handling RequestEvent.Type.ON_EXCEPTION
)
event type.getExceptionCause
in interface RequestEvent
null
if no exception has occurred.public boolean isResponseWritten()
RequestEvent
true
if the response has been successfully written. true
is returned
even for cases when the written response contains error response code.isResponseWritten
in interface RequestEvent
true
if the response was successfully written;false
when the response
has not been written yet or when writing of response failed.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.