Set content encoding header when compressed

This commit is contained in:
René Pfeuffer
2018-10-04 11:04:21 +02:00
parent 87c1f5ea54
commit 4db862abdf

View File

@@ -17,6 +17,7 @@ public class GZipResponseFilter implements ContainerResponseFilter {
if (WebUtil.isGzipSupported(requestContext::getHeaderString)) {
log.trace("compress output with gzip");
GZIPOutputStream wrappedResponse = new GZIPOutputStream(responseContext.getEntityStream());
responseContext.getHeaders().add("Content-Encoding", "gzip");
responseContext.setEntityStream(wrappedResponse);
}
}