Description
First of all: This worked with 2.1.0.GA!
We're experiencing problems with @GZIP support. It seems that the first request to a resource defines if response is gzip encoded or not.
I set a break point in org.jboss.resteasy.plugins.interceptors.encoding.ServerContentEncodingHeaderInterceptor.write(MessageBodyWriterContext) (line 38) and inspected the variables. Here an extraction from Eclipse:
this ServerContentEncodingHeaderInterceptor (id=5736) encoding "gzip" (id=5743) request HttpServletInputMessage (id=163) ... httpHeaders HttpHeadersImpl (id=150) ... requestHeaders Headers<V> (id=152) map MultivaluedMapImpl<K,V> (id=5763) ... context ServerMessageBodyWriterContext (id=5989) ... request HttpServletInputMessage (id=5959) ... httpHeaders HttpHeadersImpl (id=5953) ... requestHeaders Headers<V> (id=5954) map MultivaluedMapImpl<K,V> (id=5955)
this.request.httpHeaders.requestHeaders.map contains the headers from the first request to this resource. The ids and values never change with later requests.
context.request.httpHeaders.requestHeaders.map has a different id then the one in this.request and contains the current (correct) values.
With 2.1.0.GA (which worked) this.request was a Java Proxy:
this ServerContentEncodingHeaderInterceptor (id=4321) encoding "gzip" (id=5760) request $Proxy21 (id=5762) h ContextParameterInjector$GenericDelegatingProxy (id=5773) this$0 ContextParameterInjector (id=5787) factory ResteasyProviderFactory (id=4293) type Class<T> (org.jboss.resteasy.spi.HttpRequest) (id=4288)
As far as I can see the cause of this is a difference in org.jboss.resteasy.core.ContextParameterInjector.inject(). There are two new lines in 2.2.1:
Object delegate = ResteasyProviderFactory.getContextData(type); if (delegate != null) return delegate;
I don't know why this tow lines came in, but this delegate never changes. If there is no delegate the Java Proxy would be used as before and this returns always the current value.