How to specify Http Request timeout parameter on Java servlet container

前端 未结 3 1872
花落未央
花落未央 2020-12-07 00:47

I\'m trying to understand where I can configure a request timeout for all requests arriving to a servlet of mine (or all of my servlets)? Is that, as I think, a container pr

3条回答
  •  时光说笑
    2020-12-07 01:09

    Even though you can't control client timeout, you can make server very impatient :) For example, on Tomcat, you can do this in your connector,

    
    

    This makes server only wait 5 seconds and close the connection. Browser will get a connection closed error. You can treat it the same as timeout in client.

    Of course, this only works if the timeout is caused by the server, not connectivity issues between browser and server.

提交回复
热议问题