Vadim Beilin created CXF-5240: --------------------------------- Summary: Jsonp interceptors do not work with GZIPOutInterceptor Key: CXF-5240 URL: https://issues.apache.org/jira/browse/CXF-5240 Project: CXF Issue Type: Bug Components: JAX-RS, Transports Affects Versions: 2.5.9 Reporter: Vadim Beilin
Jsonp support via Jsonp(In,PreStream,PostStream)Interceptor (as described in http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-JSONWithPadding%28JSONP%29) conflicts with GZIPOutInterceptor. With a very simple test application request "http://localhost:7543/12?_jsonp=abc" without Gzip results in the following response bq. abc(24); With Gzip: bq. abc();24 Apparent reason is that the method org.apache.cxf.jaxrs.provider.jsonp.AbstractJsonpOutInterceptor.writeValue(Message, String) writes directly to the response output stream. When the method is changed to write to {{message.getContent(OutputStream.class)}}, responses with and without Gzip interceptor become the same "abc(24);", as expected. ------------------------ Service code: {code} package test.cxf.jsonp; import javax.ws.rs.*; @Path("/") @Produces("application/json") public class Service { @GET @Path("{id}") public int find(@PathParam("id") int id) { return id * 2; } } {code} Configuration (with Gzip) {code} <jaxrs:server id="jsonp" address="http://localhost:7543/"> <jaxrs:serviceBeans> <ref bean="serviceBean" /> </jaxrs:serviceBeans> <jaxrs:inInterceptors> <bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpInInterceptor"/> <bean class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor"/> </jaxrs:inInterceptors> <jaxrs:outInterceptors> <bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPreStreamInterceptor"/> <bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPostStreamInterceptor"/> <bean class="org.apache.cxf.transport.common.gzip.GZIPOutInterceptor"/> </jaxrs:outInterceptors> </jaxrs:server> <bean id="serviceBean" class="test.cxf.jsonp.Service" /> {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira