LZMA JAX-RS 支持
我通过对基于 REST 的 Web 服务的请求接收 LZMA 压缩数据。 jax-rs 规范是否支持 LZMA?我正在使用 JAX-RS 规范的 RESTEasy 实现。我的应用服务器响应无效请求错误
I'm receiving LZMA compressed data via a request to a REST based web service. Is LZMA supported by the jax-rs specification? I'm using the RESTEasy implementation of the JAX-RS spec. My app server is responding with an invalid request error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JAX-RS 规范不处理压缩方面的问题,因此这与 JAX-RS 的使用是正交的。但据我记得,自动处理通常只支持 gzip,尽管添加您自己的压缩编解码器应该不会太困难。
但您确定要使用 LZMA 进行压缩吗?压缩速度非常慢,而且压缩速度也不是很快。虽然它的压缩比比 gzip 好一点,但它通常不足以保证开销,并最终导致运行速度变慢。
对于 Java 压缩/解压缩速度,您可能需要查看 jvm-compressor-benchmark 结果;除了 gzip 之外,Snappy 和 LZF 编解码器甚至更快(尽管压缩程度稍差一些)。
JAX-RS specification does not handle compression aspects, so this is orthogonal to JAX-RS use. But as far as I remember, automatic handling usually just supports gzip, although adding your own compression codecs should not be too difficult.
But are you sure you want to be using LZMA for compression? It is VERY slow to compress, and not very fast to compress. While its compression ratio is bit better than that of gzip, it is often not enough to warrant the overhead, and ends up causing slower operation.
For Java compression/uncompression speeds you may want to check out jvm-compressor-benchmark results; beyond gzip, Snappy and LZF codecs are even faster (although bit less compact compression).