Java 有没有办法在tomcat中设置超时?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/202740/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to set timeouts in tomcat?
提问by timdisney
Can I set timeouts for JSP pages in tomcat either on a per page or server level?
我可以在每页或服务器级别为 tomcat 中的 JSP 页面设置超时吗?
采纳答案by anjanb
For server level, you can try this.
you have to change catalina.bat
/ catalina.sh
file
对于服务器级别,您可以尝试此操作。
你必须改变catalina.bat
/catalina.sh
文件
jvm OPTIONS : -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000
回答by Mojo
In the Tomcat server.xmlfile, the Connector element also has a connectionTimeout
attribute in milliseconds.
在 Tomcat server.xml文件中,Connector 元素还有一个connectionTimeout
以毫秒为单位的属性。
Example:
例子:
<Connector
URIEncoding="UTF-8"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true"
enableLookups="false"
maxHttpHeaderSize="8192"
maxSpareThreads="75"
maxThreads="150"
minSpareThreads="25"
port="7777"
redirectPort="8443" />