cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Beilin (JIRA)" <>
Subject [jira] [Created] (CXF-5240) Jsonp interceptors do not work with GZIPOutInterceptor
Date Wed, 28 Aug 2013 17:20:54 GMT
Vadim Beilin created CXF-5240:

             Summary: Jsonp interceptors do not work with GZIPOutInterceptor
                 Key: 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
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:
package test.cxf.jsonp;
@Path("/") @Produces("application/json")
public class Service {
    @GET @Path("{id}") public int find(@PathParam("id") int id) {
        return id * 2;

Configuration (with Gzip)
<jaxrs:server id="jsonp" address="http://localhost:7543/">
      <ref bean="serviceBean" />
       <bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpInInterceptor"/>
       <bean class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor"/>
       <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"/>
<bean id="serviceBean" class="test.cxf.jsonp.Service" />

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:

View raw message