Search in sources :

Example 1 with Gzipper

use of com.netflix.zuul.util.Gzipper in project zuul by Netflix.

the class GZipResponseFilter method processContentChunk.

@Override
public HttpContent processContentChunk(ZuulMessage resp, HttpContent chunk) {
    final Gzipper gzipper = (Gzipper) resp.getContext().get(CommonContextKeys.GZIPPER);
    gzipper.write(chunk);
    if (chunk instanceof LastHttpContent) {
        gzipper.finish();
        return new DefaultLastHttpContent(gzipper.getByteBuf());
    } else {
        return new DefaultHttpContent(gzipper.getByteBuf());
    }
}
Also used : DefaultLastHttpContent(io.netty.handler.codec.http.DefaultLastHttpContent) Gzipper(com.netflix.zuul.util.Gzipper) DefaultHttpContent(io.netty.handler.codec.http.DefaultHttpContent) LastHttpContent(io.netty.handler.codec.http.LastHttpContent) DefaultLastHttpContent(io.netty.handler.codec.http.DefaultLastHttpContent)

Aggregations

Gzipper (com.netflix.zuul.util.Gzipper)1 DefaultHttpContent (io.netty.handler.codec.http.DefaultHttpContent)1 DefaultLastHttpContent (io.netty.handler.codec.http.DefaultLastHttpContent)1 LastHttpContent (io.netty.handler.codec.http.LastHttpContent)1