0

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?

chriso153
  • 23
  • 5

1 Answers1

0

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.

Steve11235
  • 2,849
  • 1
  • 17
  • 18
  • Thanks for responding, but that's not what I am looking for. The point of web fragments is that the JARs can have their own set of static content that is served, eliminating the need to have to put it into the WAR. Specifically, I am creating a JAR for real-time management of log4j logger levels. Many web applications can drop the JAR into their project and get this management for free. Theoretically at least if I could get this to work. – chriso153 Aug 04 '17 at 02:07