A simple wait filter for java web application.
Add a Thread.sleep(x ms) on your web application to test.
Usefull for testing purpose like how your javascript app behave when calling a slow REST api.
Add the release jar to your WEB-INF/lib directory.
Add filter configuration in your web.xml :
<filter>
<filter-name>WaitFilter</filter-name>
<filter-class>net.arnulfo.waitfilter.WaitFilter</filter-class>
<init-param>
<!-- Time to sleep in millisecond -->
<param-name>WaitTime</param-name>
<param-value>5000</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>WaitFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
The wait time can be changed while your web app is running with JMX. Use a JMX Browser like VisualVM (need MBeans plugin), JConsole or JMC.