Resteasy通常启用GZIP [英] Resteasy generally enable GZIP

查看:182
本文介绍了Resteasy通常启用GZIP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RestEasy + Java EE应用程序.当我将@GZIP添加到组件类中时,如果客户端发送"accepts:gzip"

,则会将服务器答案压缩为gzip

是否可以普遍启用所有组件的gzip?我不想将注释添加到每个班级.

我正在使用RestEasy JAX-RS 3.0.1

解决方案

否,没有注释可以为所有资源启用gzip.如果您想放弃将注释添加到每个类中,则可以创建一个servlet过滤器,该过滤器查看传入的标头并在输出时对响应进行gzip压缩.

I have a RestEasy + Java EE application. When I add @GZIP to a component class, the server-answer is gzipped, if the client sends "accepts:gzip"

Is there a way to generally enable gzip for all components? I don't like to add the annotation to every class.

I'm using RestEasy JAX-RS 3.0.1

解决方案

No, there is no way with annotations to enable gzip for all resources. If you wanted to forego adding the annotation to every class you could create a servlet filter that looks at the incoming headers and gzips the response on the way out.

这篇关于Resteasy通常启用GZIP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆