On 17/05/2018 15:43, Jeremy Collins wrote:

<snip/>

At this point we're unsure if this is an actual bug in Tomcat or an
incorrect usage of getResourceAsStream(path) on our part so

we're looking for advice.

I think it is a bit of both.

ServletContext.getResourceAsStream(path) won't normally return a resource that is packaged in a JAR file. The exception to this is if the resource is packaged under META-INF/resources as per the 'package static resources in a JAR' feature that was added in Servlet 3.0.

It looks to me like META-INF/resources does everything you need it to - and will be supported by any Servlet 3.0 compliant container (7.0.x onwards in Tomcat's case). I'd look at using it.

ClassLoader.getResourceAsStream(path) is the way to retrieve a resource from a JAR but that isn't working in this case.

Tomcat uses the same code for static and class loader resources but it is meant to distinguish between the two. However, it looks like there is a bug in Tomcat's resource handling that hides this resource once the static look-up fails. I need to dig into this some more.

And thanks for the test case. Being able to reproduce this makes investigation a whole lot easier.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to