jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: Accessing request in WriterInterceptor.aroundWriteTo() ?

From: Bill Burke <bburke_at_redhat.com>
Date: Wed, 07 Nov 2012 18:40:44 -0500

Or, what you could do is write a ContainerRequestFilter and set some
roperites thaat contained the accept-encoding. Then use those in the
WriterInterceptor.

On 11/7/2012 5:29 PM, Jan Algermissen wrote:
>
> I am wondering: is there a way to access the current request in a WriterIterceptor on the container side?
>
> What I want to do is to gzip-encode the output stream but only if the client said 'Accept-Encoding: gzip'.
>
> Thus I'd like to be able to do sth like
>
> @Override
> public void aroundWriteTo(WriterInterceptorContext wCtx) ... {
>
> if( wCtx.getRequest().getHeader('Accept-Encoding') ... 'gzip') {
> ... hook in gzip output stream
> }
>
> }
>
>
> What do you think - or what am I missing?
>
> Jan
>
>
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com