[jax-rs-spec users] [jsr339-experts] Accessing request in WriterInterceptor.aroundWriteTo() ?

From: Jan Algermissen <>
Date: Wed, 7 Nov 2012 23:29:57 +0100

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

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?