Jersey 2 gzip 压缩没有 Content-Encoding header 响应

Jersey 2 gzip compression not have Content-Encoding header in response

我读过这个:compress-responses-in-jersey 并且有 Jersey 2 配置:

    @ApplicationPath("/jaxrs/")
public class AppConfig extends ResourceConfig {

    public AppConfig() {
        super(AdvertisementResource.class, MultiPartFeature.class);
        packages("jaxrs");
        EncodingFilter.enableFor(this, GZipEncoder.class, DeflateEncoder.class);
    }
}

我有header请求:

GET http://localhost:8081/jaxrs/admin-adblock
Accept:application/json
Cache-Control:no-cache
Content-Type:application/json
Authorization:Basic c21h... 
Accept-Encoding:gzip,deflate

但是header回复是:

HTTP/1.1 200 OK
Content-Type: application/json
Vary: Accept-Encoding
Server: Jetty(9.2.2.v20140723)

Header 作为响应 Content-Encoding:gzip 仅丢失 Vary: Accept-Encoding 如果我有:

EncodingFilter.enableFor(this, GZipEncoder.class, DeflateEncoder.class);

如果我删除压缩和注释 EncodingFilter 行响应 header 是:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(9.2.2.v20140723)

或者这个:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 369
Server: Jetty(9.2.2.v20140723)

我正在使用 Intellij Rest Client Tool 进行测试,但我不确定我是否收到来自服务器的压缩响应?

我已经下载球衣源代码并设置断点 here 并使用 Intellij 调试休息服务 Web 应用程序似乎在此处添加了 CONTENT_ENCODING gzip:

response.getHeaders().putSingle(HttpHeaders.CONTENT_ENCODING, contentEncoding);

但它在 Intellij Rest Client 工具的响应中缺失 header..

我已经下载了 SoapUI 并测试了相同的 Rest 请求响应 headers:

HTTP/1.1 200 OK
Content-Type: application/json
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 204
Server: Jetty(9.2.2.v20140723)

Intellij Rest 客户端工具正在隐藏响应 headers Content-Encoding 和 Content-Length.. 我打开了新的 issue