Search code examples
javajax-rsgzipresteasyrest-client

RestEasy : javax.ws.rs.ProcessingException: GZIP input exceeds max size: 10000000


I am trying to read a large response. I am getting this error "javax.ws.rs.ProcessingException: RESTEASY003357: GZIP input exceeds max size: 10000000"

We are calling a rest service using jaxrs WebTarget. Everything working fine if the response is small. If the response is huge I am getting this error.

javax.ws.rs.core.Response response = webTarget
            .register(CustomAcceptEncodingGZIPFilter.class,999999998)
            .register(new CustomGZIPDecodingInterceptor(999999999),999999999)
            .register(CustomGZIPEncodingInterceptor.class, 999999997)
            .path(path)
            .request()
            .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
            .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
            .get();

I tried the solution as per https://docs.jboss.org/resteasy/docs/3.5.1.Final/userguide/html/gzip.html. Still, I am not able to fix this.

I am getting 200 response code,But while reading the response entity I am getting this exception. Exception trace

javax.ws.rs.ProcessingException: RESTEASY003357: GZIP input exceeds max size: 10000000
    at org.jboss.resteasy.plugins.interceptors.GZIPDecodingInterceptor$FinishableGZIPInputStream.read(GZIPDecodingInterceptor.java:87)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
    at java.io.InputStreamReader.read(InputStreamReader.java:184)
    at java.io.Reader.read(Reader.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

Thanks


Solution

  • Adding this param in servlet context "resteasy.gzip.max.input" solved the issue.

    servletContext.setInitParameter("resteasy.gzip.max.input",
                        String.valueOf(Integer.MAX_VALUE));