ServletContext: difference between interface vs implementation?

51 Views Asked by At

ServletContext interface docs:

The path must begin with a / and is interpreted as relative to the current context root, or relative to the /META-INF/resources directory of a JAR file inside the web application's /WEB-INF/lib directory. This method will first search the document root of the web application for the requested resource, before searching any of the JAR files inside /WEB-INF/lib. The order in which the JAR files inside /WEB-INF/lib are searched is undefined.

I tested with Tomcat and it's not finding anything from WEB-INF/lib/*.jar files. Can the implementation differ? I have CommonRes.jar(in WEB-INF/lib) with this file inside:test.css

request.getServletContext().getResource("test.css");
request.getServletContext().getResource("/test.css");
request.getServletContext().getResource("/WEB-INF/test.css");

All this getResource() variants returns null.

0

There are 0 best solutions below