I don't know if the spec explicity supports this, but our
impmlementation does.
On 11/8/2012 2:30 AM, Jan Algermissen wrote:
>
> On Nov 8, 2012, at 3:52 AM, Bill Burke <bburke_at_redhat.com> wrote:
>
>>
>>
>> On 11/7/2012 6:45 PM, Jan Algermissen wrote:
>>>
>>> On Nov 8, 2012, at 12:39 AM, Bill Burke <bburke_at_redhat.com> wrote:
>>>
>>>> Or an injection of ContainerRequestContext?
>>>>
>>>> @Context
>>>> ContainerRequestContext rctx;
>>>
>>> Yes, that would be even better - but wouldn't that have to be an instance local to aroundWriteTo?
>>>
>>
>> thread local proxies for these types of field injections.
>>
>
> See... thread local has been on my dive-into list for a while. Thanks.
>
> So, I would just do this, right? (IOW, nothing new needed to support my use case)
>
> @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
> }
> }
> }
>
>
>
>
>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com