jsr369-experts@servlet-spec.java.net

[jsr369-experts] [123-META-INF/resourcesAndClassFiles] Proposal (was: Re: META-INF/resources/WEB-INF/classes?)

From: Edward Burns <edward.burns_at_oracle.com>
Date: Tue, 3 Feb 2015 16:24:37 -0800

>>>>> On Thu, 22 Jan 2015 17:30:09 +0000, Mark Thomas <markt_at_apache.org> said:

GW> -Our understanding of META-INF/resources is that it is only for static
GW> -content that can be obtained via getResource and that it is not a place
GW> -where you can put things like WEB-INF/classes and expect them to appear
GW> -on the context classpath.

MT> Agreed completely.

I have filed SERVLET_SPEC-123 for this.

[...]

GW> -So I think we need to clarify the spec on this point one way or the other.

MT> +1. The text referencing static resources in A.3 of the 3.1 spec should
MT> really be in the main body of the spec.

Thanks for starting me off on the trail, Mark.

I found this text in Section 10.10 Welcome Files

  All of the above static content can also be packaged in a JAR file
  with the content listed above packaged in the META-INF/resources
  directory of the jar file. The JAR file can then be included in the
  WEB-INF/lib directory of the web application

That doesn't look like a normative declaration, though.

I propose we insert some text in section 4.6 Resources, excerpted here.

[...]

  The getResource and getResourceAsStream methods take a String with a
  leading "/" as an argument that gives the path of the resource
  relative to the root of the context or relative to the
  META-INF/resources directory of a JAR file inside the web
  application's WEB-INF/lib directory.

<newText>
  If there is a "WEB-INF" entry inside the META-INF/resources entry of a
  JAR file in WEB-INF/lib, it and all child entries must be ignored.
  META-INF/resources is not intended for content that is consumed as
  executable code in the JVM, with the one notable exception of JSP
  files.
</newText>

  These methods will first search the root of the web application
  context for the requested resource before looking at any of the JAR
  files in the WEB-INF/lib directory. The order in which the JAR files
  in the WEB-INF/lib directory are scanned is undefined.

[...]

How's that?

Ed

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| 24 days til DevNexus 2015
| 34 days til JavaLand 2015
| 44 days til CONFESS 2015