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如OS)。
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屋!