Class RequestEventImpl
java.lang.Object
org.glassfish.jersey.server.internal.monitoring.RequestEventImpl
- All Implemented Interfaces:
RequestEvent
Request event implementation. Instances are immutable.- Author:
- Miroslav Fuksa
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.glassfish.jersey.server.monitoring.RequestEvent
RequestEvent.ExceptionCause, RequestEvent.Type -
Method Summary
Modifier and TypeMethodDescriptionGet the container request.Getcontainer request filtersused during the request filtering phase.Get the container response.Getcontainer response filtersused during the response filtering phase.Get the latest exception, if any, thrown by the request and response processing.Get theexception cause.Get theExceptionMapperthat was found and used during the exception mapping phase.getType()Returns thetypeof this event.Get theextended uri infoassociated with this request.booleanReturnstrueif the response was successfully mapped from an exception byexception mappers.booleanReturnstrueif the response has been successfully written.booleanReturntrueif the request and response has been successfully processed.
-
Method Details
-
getContainerRequest
Description copied from interface:RequestEventGet the container request. The container request is available for all event types. Returned request must not be modified by therequest event listener.- Specified by:
getContainerRequestin interfaceRequestEvent- Returns:
- The non-null container request.
-
getContainerResponse
Description copied from interface:RequestEventGet the container response. The response is available only for certainevent types. The returned response might vary also on the event type. The getter returns always the latest response being processed. So, for example for eventRequestEvent.Type.EXCEPTION_MAPPING_FINISHEDevent type the method returns mapped response and not the original response created from execution of the resource method.- Specified by:
getContainerResponsein interfaceRequestEvent- Returns:
- Latest response being processed or
nullif no response has been produced yet.
-
getException
Description copied from interface:RequestEventGet the latest exception, if any, thrown by the request and response processing. When this method returns not null value, the methodRequestEvent.getExceptionCause()returns the origin of the exception.- Specified by:
getExceptionin interfaceRequestEvent- Returns:
- Exception thrown or
nullif no exception has been thrown.
-
getType
Description copied from interface:RequestEventReturns thetypeof this event.- Specified by:
getTypein interfaceRequestEvent- Returns:
- Request event type.
-
getUriInfo
Description copied from interface:RequestEventGet theextended uri infoassociated with this request. This method returns null forRequestEvent.Type.STARTevent. The returnedExtendedUriInfocan be used to retrieve information relevant to many event types (especially event types describing the matching process).- Specified by:
getUriInfoin interfaceRequestEvent- Returns:
- Extended uri info or
nullif it is not available yet.
-
getExceptionMapper
Description copied from interface:RequestEventGet theExceptionMapperthat was found and used during the exception mapping phase.- Specified by:
getExceptionMapperin interfaceRequestEvent- Returns:
- Exception mapper or
nullif no exception mapper was found or even needed.
-
getContainerRequestFilters
Description copied from interface:RequestEventGetcontainer request filtersused during the request filtering phase.- Specified by:
getContainerRequestFiltersin interfaceRequestEvent- Returns:
- Container request filters or
nullif no filters were used yet.
-
getContainerResponseFilters
Description copied from interface:RequestEventGetcontainer response filtersused during the response filtering phase.- Specified by:
getContainerResponseFiltersin interfaceRequestEvent- Returns:
- Container response filter or
nullif no filters were used yet.
-
isSuccess
public boolean isSuccess()Description copied from interface:RequestEventReturntrueif 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 returnstrue.- Specified by:
isSuccessin interfaceRequestEvent- Returns:
- True if the response was successfully processed.
-
isResponseSuccessfullyMapped
public boolean isResponseSuccessfullyMapped()Description copied from interface:RequestEventReturnstrueif the response was successfully mapped from an exception byexception 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 theRequestEvent.Type.EXCEPTION_MAPPING_FINISHEDevent type.- Specified by:
isResponseSuccessfullyMappedin interfaceRequestEvent- Returns:
- True if the exception occurred and it was successfully mapped into a response.
-
getExceptionCause
Description copied from interface:RequestEventGet theexception cause. This method is relevant only in cases whenRequestEvent.getException()returns non-null value (for example when handlingRequestEvent.Type.ON_EXCEPTION) event type.- Specified by:
getExceptionCausein interfaceRequestEvent- Returns:
- Exception cause of the latest exception or
nullif no exception has occurred.
-
isResponseWritten
public boolean isResponseWritten()Description copied from interface:RequestEventReturnstrueif the response has been successfully written.trueis returned even for cases when the written response contains error response code.- Specified by:
isResponseWrittenin interfaceRequestEvent- Returns:
trueif the response was successfully written;falsewhen the response has not been written yet or when writing of response failed.
-