Tomcat JSR356 Websocket - 禁用 permessage-deflate 压缩 [英] Tomcat JSR356 Websocket - disable permessage-deflate compression
问题描述
我正在开发一个 Java servlet,它在 Tomcat 8.0.18 服务器上运行并使用 JSR356 websocket API 与浏览器通信.默认情况下,Tomcat 使用permessage-deflate"压缩在两个方向上压缩 websocket 消息.我想不使用websocket压缩,怎么关闭?我尝试在文件 server.xml 中使用 compression="off" 选项,但这并没有改变任何东西.我怎样才能关闭它?
I'm, working on a Java servlet which runs on a Tomcat 8.0.18 server and uses the JSR356 websocket API to communicate with a browser. By default Tomcat uses the "permessage-deflate" compression to compress the websocket messages in both directions. I want to use no websocket compression, how can it be turned off? I have tried to use the compression="off" option in the file server.xml but that didn't change anything. How can i turn it off?
推荐答案
请尝试添加jvm选项
-Dorg.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS=true
到 catalina.bat(适用于 Windows)或 catalina.sh(适用于类似 Unix 的操作系统).
to catalina.bat (for windows) or catalina.sh (for unix like OS).
例如在 catalina.sh 的开头添加这一行
e.g. add this line at the beginning of catalina.sh
CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS=true"
在 catalina.bat 的开头添加这一行
add this line at the beginning of catalina.bat
set CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS=true"
这篇关于Tomcat JSR356 Websocket - 禁用 permessage-deflate 压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!