Skip to main content

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

  • From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen@...>
  • To: jsr339-experts@...
  • Subject: [jsr339-experts] Re: [jax-rs-spec users] Re: Accessing request in WriterInterceptor.aroundWriteTo() ?
  • Date: Thu, 8 Nov 2012 09:22:21 -0500


On Nov 8, 2012, at 8:52 AM, Bill Burke <bburke@...> wrote:

I don't know if the spec explicity supports this, but our impmlementation does.

On 11/8/2012 2:30 AM, Jan Algermissen wrote:

@Provider
class TestInterceptor implements WriterInterceptor {

  @Context
  HttpHeaders headers;

  @Override
  public void aroundWriteTo(WriterInterceptorContext wCtx)
         throws IOException, WebApplicationException {

      String h = headers.getHeaderString("Accept-Encoding");
      if(if h !=null && h.contains("gzip") ) {
        // hook gzipper into the ostream
      }
  }
}

 Yes, injecting HttpHeaders would be the portable way to do it. Section 8.1 talks about the use of thread local proxies as a common solution to the scoping issue.

-- Santiago


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

Jan Algermissen 11/07/2012

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

Bill Burke 11/07/2012

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

Jan Algermissen 11/07/2012

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

Bill Burke 11/08/2012

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

Jan Algermissen 11/08/2012

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

Bill Burke 11/08/2012

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

Jan Algermissen 11/08/2012

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

Marek Potociar 11/11/2012

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

Marek Potociar 11/11/2012

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

Santiago Pericas-Geertsen 11/08/2012

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

Bill Burke 11/07/2012

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

Jan Algermissen 11/07/2012
 
 
Close
loading
Please Confirm
Close