Question about ContainerRequestFilter and ContainerResponseFilter

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about ContainerRequestFilter and ContainerResponseFilter

Nikolaos Beredimas
In an application that uses both ContainerRequestFilter and ContainerResponseFilter:

Suppose that the filter(ContainerRequestContext crc) of the request filter 
alters the incoming request context crc 

So when it's time for the response filter to run, what request context crc does filter(ContainerRequestContext crc, ContainerResponseContext crc1) of the response filter see?

The original one or the altered one?


Reply | Threaded
Open this post in threaded view
|

Re: Question about ContainerRequestFilter and ContainerResponseFilter

Joel Joseph
The altered one.

Both original and altered reference the same client request context object.

Please refer to ClientRuntime class for implementation details.

Thanks,
Joel

On Thu, Dec 1, 2016, 6:56 AM Nikolaos Beredimas <[hidden email]> wrote:
In an application that uses both ContainerRequestFilter and ContainerResponseFilter:

Suppose that the filter(ContainerRequestContext crc) of the request filter 
alters the incoming request context crc 

So when it's time for the response filter to run, what request context crc does filter(ContainerRequestContext crc, ContainerResponseContext crc1) of the response filter see?

The original one or the altered one?


Reply | Threaded
Open this post in threaded view
|

Re: Question about ContainerRequestFilter and ContainerResponseFilter

Joel Joseph


https://github.com/jersey/jersey/blob/master/core-client/src/main/java/org/glassfish/jersey/client/ClientRuntime.java


On Thu, Dec 1, 2016, 7:02 AM Joel Joseph <[hidden email]> wrote:
The altered one.

Both original and altered reference the same client request context object.

Please refer to ClientRuntime class for implementation details.

Thanks,
Joel


On Thu, Dec 1, 2016, 6:56 AM Nikolaos Beredimas <[hidden email]> wrote:
In an application that uses both ContainerRequestFilter and ContainerResponseFilter:

Suppose that the filter(ContainerRequestContext crc) of the request filter 
alters the incoming request context crc 

So when it's time for the response filter to run, what request context crc does filter(ContainerRequestContext crc, ContainerResponseContext crc1) of the response filter see?

The original one or the altered one?