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()
RequestEventrequest event listener.getContainerRequest in interface RequestEventpublic ContainerResponse getContainerResponse()
RequestEventevent 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 RequestEventnull if no response has been produced yet.public Throwable getException()
RequestEventRequestEvent.getExceptionCause() returns the origin of the exception.getException in interface RequestEventnull if no exception has been thrown.public RequestEvent.Type getType()
RequestEventtype of this event.getType in interface RequestEventpublic ExtendedUriInfo getUriInfo()
RequestEventextended 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 RequestEventnull if it is not available yet.public ExceptionMapper<?> getExceptionMapper()
RequestEventExceptionMapper that was found and used during the exception mapping phase.getExceptionMapper in interface RequestEventnull if no exception mapper was found or even needed.public Iterable<ContainerRequestFilter> getContainerRequestFilters()
RequestEventcontainer request filters used during the request filtering
phase.getContainerRequestFilters in interface RequestEventnull if no filters were used yet.public Iterable<ContainerResponseFilter> getContainerResponseFilters()
RequestEventcontainer response filters used during the response filtering
phase.getContainerResponseFilters in interface RequestEventnull if no filters were used yet.public boolean isSuccess()
RequestEventtrue 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 RequestEventpublic boolean isResponseSuccessfullyMapped()
RequestEventtrue 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 RequestEventpublic RequestEvent.ExceptionCause getExceptionCause()
RequestEventexception 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 RequestEventnull if no exception has occurred.public boolean isResponseWritten()
RequestEventtrue if the response has been successfully written. true is returned
even for cases when the written response contains error response code.isResponseWritten in interface RequestEventtrue 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.