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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 11:19:03  来源:igfitidea点击:

Is there a way to set timeouts in tomcat?

javajsptomcattimeout

提问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.shfile

对于服务器级别,您可以尝试此操作。
你必须改变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 connectionTimeoutattribute 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" />