This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm producing a filter that modifies the response text of JSP requests. However, I also want to modify included static files such as .css and .js
files. The filter works fine on the output from the JSP's, but doesn't on any .css and .js requests. I can see the .css files and .js files being processed, but the response text they work on is empty.
I'm thinking that the servlet engine doesn't handle static content, and this is why the response for static content is empty.
Is this the case? How are requests to static files served up in Tomcat 6?
If you'll look in the TOMCAT_HOME/conf/web.xml file you'll see the answer.
<!-- ================== Built In Servlet Definitions ==================== -->
<!-- The default servlet for all web applications, that serves static -->
<!-- resources. It processes all requests that are not mapped to other -->
<!-- servlets with servlet mappings (defined either here or in your own -->
<!-- web.xml file. This servlet supports the following initialization -->
<!-- parameters (default values are in square brackets): -->
The actual default servlet itself is defined in the usual way.