6

The objective is simple. Limit how much time the request is ocuppying a Tomcat thread.

I've searched and found several "hacks" but I was expecting that Tomcat could give a similar setting like PHP set_time_limit.

knokio
  • 2,000
  • 2
  • 13
  • 13

1 Answers1

0

You can edit the server.xml file present under config folder of tomcat to set the connection timeout value.

Find the below line of code in server.xml

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

Edit the connectionTimeout attribute to the value you want. The value needs to be given in milliseconds.

This will set the connection timeout value for http connection.In case you want to do so for https (SSL) you have to set the attribute in below line of code in server.xml too

Original

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Modified

<Connector port="8009" protocol="AJP/1.3" connectionTimeout="30000" redirectPort="8443" />

Reference is tomcat documentation

Tomcat 7 Doc

Ankit Rastogi
  • 597
  • 4
  • 14