Reputation: 11744
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
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
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