Package org.glassfish.jersey.client.spi
Interface PreInvocationInterceptor
The interceptor of a client request invocation that is executed before the invocation itself, i.e. before the
ClientRequestFilter
is invoked.
It is ensured that all PreInvocationInterceptors
are executed before the request, in the order given by the
Priority
, the higher the priority the sooner the execution. Any RuntimeException
thrown when
the beforeRequest(ClientRequestContext)
is being processed is accumulated and
a multi RuntimeException with other exceptions supressed
is being thrown.
For asynchronous invocation, the PreInvocationInterceptor
is invoked in the main thread, i.e. not in the thread
provided by ExecutorService
. For reactive
invocations, this depends on the provided RxInvoker
. For the default Jersey asynchronous
JerseyCompletionStageRxInvoker
, PreInvocationInterceptor
is invoked in the
main thread, too.
Should the ClientRequestContext.abortWith(Response)
be utilized, the request abort is performed after every
registered PreInvocationInterceptor
is processed. If multiple
PreInvocationInterceptors PreInvocationInterceptor
tries to utilize ClientRequestContext.abortWith(Response)
method, the second and every next throws IllegalStateException
.- Since:
- 2.30
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeRequest
(ClientRequestContext requestContext) The method invoked before the request starts.
-
Method Details
-
beforeRequest
The method invoked before the request starts.- Parameters:
requestContext
- the request context shared withClientRequestFilter
.
-