【问题标题】:GZip compression of REST response in WildflyWildfly 中 REST 响应的 GZip 压缩
【发布时间】:2014-11-02 16:01:58
【问题描述】:

我正在编写一个 REST 服务以发送 xml 格式的数据列表。如何压缩响应。

我看到了从文件系统发送 zip 文件的示例代码,但我想动态构建 zip 部分。首先查询我的数据库并构建要发送到客户端的 xml 数据。必须压缩此 xml 数据。

请指教。

File file = new File("Test.zip"); // Build this zip dynamically from the xml data and not from sile system
ResponseBuilder response = Response.ok((Object) file);
response.header("Content-Disposition", "attachment; filename = Test.zip");
return response.build();

【问题讨论】:

标签: java rest jax-rs gzip wildfly-8


【解决方案1】:

只要放这个注解

@GZIP
public class SomeController{
}

【讨论】:

  • 如果能在代码中加上一些解释就更好了。
猜你喜欢
  • 2014-02-20
  • 2012-02-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-02
  • 1970-01-01
  • 2011-07-13
相关资源
最近更新 更多