gzipされたコンテンツを出力したいRESTメソッドがあります。私が追加しました
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
web.xmlのサーブレットへ
デバッグにより、コードがGZIPContentEncodingFilterクラスを通過することがわかりますが、出力には.gzipプレフィックスがなく、コンテンツは圧縮されていません。代わりに、通常のjsonです。ジャージー1.14を使用しています。
メソッドは次のようになります。
@GET
@Path("/fundlight")
@Produces(MediaType.APPLICATION_JSON)
public Response getFundLightList() {
StopWatch watch = new StopWatch();
watch.start();
Collection<Object> objectResults = null;
objectResults = getCacheMap("FundLight").values();
List<FundLight> fundLightList = new ArrayList(objectResults);
watch.stop();
GenericEntity<List<FundLight>> entity = new GenericEntity<List<FundLight>>(fundLightList) {
};
ResponseBuilder builder = Response.ok(entity);
return builder.build();
}