3

For the testing purposes I need to make Tomcat to respond with late http responses. It is quite clear how to do it for the servlet responses. But it is not clear if I want Tomcat to answer, say with 10000 ms delay for each static file request. How it can be configured?

1 Answer 1

1

If I read this write - you want to introduce a 10000 ms delay for any incoming request where you are serving a static resource.

The easy way to do this is via a servlet filter mapped to the default servlet.

For brevity ...

 doFilter(ServletRequest request, ServletResponse response, FilterChain chain) { Thread.sleep(10000); chain.doFilter(request, response); } 

Then map the filter to the default servlet:

 <filter-mapping> <filter-name>delayFilter</filter-name> <servlet-name>default</servlet-name> </filter-mapping> 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.