Package org.glassfish.jersey.client.spi
Interface PostInvocationInterceptor
-
@Beta @Contract @ConstrainedTo(CLIENT) public interface PostInvocationInterceptor
The interceptor of a client request invocation that is executed after the request invocation itself, i.e. after theClientResponseFiltersare executed. It is ensured that allPostInvocationInterceptorsare executed after the request, in the reverse order given by thePriority, the higher the priority the later the execution. AnyThrowablethrown when theafterRequest(ClientRequestContext, ClientResponseContext)oronException(ClientRequestContext, ExceptionContext)is being processed is accumulated and a multi RuntimeException with otherexceptions supressedis being thrown at the end (possibly encapsulated in aProcessingExceptionif not a singleRuntimeException), unless resolved byonException(ClientRequestContext, ExceptionContext). During thePostInvocationInterceptorprocessing, the accumulatedDequeof theThrowablesis available in thePostInvocationInterceptor.ExceptionContext. For asynchronous invocation, thePostInvocationInterceptoris invoked in the request thread, i.e. in the thread provided byExecutorService. When the lowest priorityPostInvocationInterceptoris executed first, one of the two methods can be invoked.afterRequest(ClientRequestContext, ClientResponseContext)in a usual case when no previousThrowablewas caught, oronException(ClientRequestContext, ExceptionContext)when theThrowablewas caught. Should thePostInvocationInterceptor.ExceptionContext.resolve(Response)be utilized in that case, the nextPostInvocationInterceptor'safterRequestmethod will be invoked. Similarly, when aThrowableis caught during thePostInvocationInterceptorexecution, the nextPostInvocationInterceptor'sonExceptionmethod will be invoked.- Since:
- 2.30
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfacePostInvocationInterceptor.ExceptionContextThe context providing information when theThrowable(typically, theRuntimeException) is caught.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidafterRequest(jakarta.ws.rs.client.ClientRequestContext requestContext, jakarta.ws.rs.client.ClientResponseContext responseContext)The method is invoked after a request when noThrowableis thrown, or theThrowablesareresolvedby previousPostInvocationInterceptor.voidonException(jakarta.ws.rs.client.ClientRequestContext requestContext, PostInvocationInterceptor.ExceptionContext exceptionContext)The method is invoked after aThrowableis caught during the client request chain processing.
-
-
-
Method Detail
-
afterRequest
void afterRequest(jakarta.ws.rs.client.ClientRequestContext requestContext, jakarta.ws.rs.client.ClientResponseContext responseContext)The method is invoked after a request when noThrowableis thrown, or theThrowablesareresolvedby previousPostInvocationInterceptor.- Parameters:
requestContext- the request context.responseContext- the response context of the originalResponseor response context defined by the newresolvingResponse.
-
onException
void onException(jakarta.ws.rs.client.ClientRequestContext requestContext, PostInvocationInterceptor.ExceptionContext exceptionContext)The method is invoked after aThrowableis caught during the client request chain processing.- Parameters:
requestContext- the request context.exceptionContext- the context available to handle the caughtThrowables.
-
-