Servlet 3 web fragments - not serving static content from folder in META-INF

502 Views Asked by At

I am having trouble deciding if I don't correctly understand the Servlet 3.0 spec or if there is a bug in Tomcat.

Here is my situation. I have a web application that includes a jar project. The web application defines a set of REST endpoints using Jersey 2.9. The jar project also defines REST endpoints (also using Jersey 2.9) and has static content in the META-INF/resource directory. The structure of the META-INF directory in the jar looks like this:

META-INF
  |- resources
    |- test.html
    |- testfolder
      |- test2.html

I run this on Tomcat 8.5.16. When I'm running this I get the following results:

  1. WAR REST endpoints: successful
  2. JAR REST endpoints: successful
  3. /test.html: successful
  4. /testfolder/test2.html - FAILED with a 404

The WAR project has no static content, so I no there are no conflicts occurring. I have checked the JAR file inside the WAR and it contains the structure shown above.

Any ideas on why the top level html file is served, but not the one in the folder?

1

There are 1 best solutions below

1
On

Put your resources in a top-level folder in your WAR named /static. Tomcat will then serve them. There are other folder names that do the same thing.