theapache64
theapache64

Reputation: 11744

How to delay all tomcat server request

I want to delay all Tomcat server request for the testing purpose. I've been calling Thread.sleep(milliseconds) from the servlet to make the delay. Is there any other way ?

Upvotes: 1

Views: 831

Answers (2)

Damien Allison
Damien Allison

Reputation: 109

Another alternative would be to use an external reverse proxy like nginx using the echo module.

https://www.nginx.com/resources/wiki/modules/echo/#

Upvotes: 0

Kayaman
Kayaman

Reputation: 73578

You could make a javax.servlet.Filter that introduces the delay. That way you don't have to add the Thread.sleep() to every servlet manually, and you can introduce additional logic (such as random delay) in a single place.

Upvotes: 3

Related Questions