user629923
user629923

Reputation: 541

serving static files from servlet filter

I have to serve a static file (based on the request uri) from a servlet filter, if the response from the servlet has some "hint" to do so (that's not the point). So my question is, what is the best way to serve a static file from a servlet.Filter?

Upvotes: 1

Views: 2282

Answers (1)

adarshr
adarshr

Reputation: 62573

There is one way: Forward the response to the static file.

EDIT

filterConfig.getServletContext().getRequestDispatcher("/path/to/static-file.jsp").forward(request, response);

Upvotes: 4

Related Questions