I finally found some more explanation by myself by digging into Tomcat 8 source
code.
In the javadoc of the interface org.apache.catalina.WebResourceRoot everything
is very clear (see below):
> Pre- and Post-Resources may define WEB-INF/lib and WEB-INF/classes in
> order to make additional libraries and/or classes available to the web
> application. This mechanism replaces and extends the following features >that
> were present in earlier versions:
> * Aliases - Replaced by Post-Resources with the addition of support for
> single files as well as directories and JARs.
> * VirtualWebappLoader - Replaced by Pre- and Post-Resources mapped to
> WEB-INF/lib and WEB-INF/classes
> * VirtualDirContext - Replaced by Pre- and Post-Resources
> * External repositories - Replaced by Pre- and Post-Resources mapped to
> WEB-INF/lib and WEB-INF/classes
> * Resource JARs - Same feature but implemented using the same mechanism
> as all the other additional resources.
That's exactly the question I was asking! It should definitely be added in the
documentation chapter bout Resource.
Regards,
Renaud
-------------------
public interface WebResourceRoot extends Lifecycle
Represents the complete set of resources for a web application. The resources
for a web application comprise of multiple ResourceSets and when looking for a
Resource, the ResourceSets are processed in the following order:
1. Pre - Resources defined by the <PreResource> element in the web
application&aposs context.xml. Resources will be searched in the order they
were specified.
2. Main - The main resources for the web application - i.e. the WAR or
the directory containing the expanded WAR
3. JARs - Resource JARs as defined by the Servlet specification. JARs
will be searched in the order they were added to the ResourceRoot.
4. Post - Resources defined by the <PostResource> element in the web
application&aposs context.xml. Resources will be searched in the order they
were specified.
The following conventions should be noted:
* Write operations (including delete) will only be applied to the main
ResourceSet. The write operation will fail if the presence of a Resource in one
of the other ResourceSets effectively makes the operation on the main
ResourceSet a NO-OP.
* A file in a ResourceSet will hide a directory of the same name (and
all the contents of that directory) in a ResourceSet that is later in the
search order.
* Only the main ResourceSet may define a META-INF/context.xml since
that file defines the Pre- and Post-Resources.
* As per the Servlet specification, any META-INF or WEB-INF directories
in a resource JAR will be ignored.
* Pre- and Post-Resources may define WEB-INF/lib and WEB-INF/classes in
order to make additional libraries and/or classes available to the web
application.
This mechanism replaces and extends the following features that were present in
earlier versions:
* Aliases - Replaced by Post-Resources with the addition of support for
single files as well as directories and JARs.
* VirtualWebappLoader - Replaced by Pre- and Post-Resources mapped to
WEB-INF/lib and WEB-INF/classes
* VirtualDirContext - Replaced by Pre- and Post-Resources
* External repositories - Replaced by Pre- and Post-Resources mapped to
WEB-INF/lib and WEB-INF/classes
* Resource JARs - Same feature but implemented using the same mechanism
as all the other additional resources.
------------------------
Renaud
-----Message d'origine-----
De : Mark Thomas [mailto:[email protected]]
Envoyé : mardi 11 février 2014 20:09
À : Tomcat Users List
Objet : Re: How to replace VirtualWebappLoader in Tomcat 8
On 11/02/2014 17:31, Renaud Pelissier wrote:
> Okay, I had it working finally by setting webAppMount to "/WEB-INF/classes"
> for every classes directory.
> So I understand the /WEB-INF/classes mount point is hard coded into the
> default Loader? Is it different to use /WEB-INF/lib?
/WEB-INF/classes is for classes
/WEB-INF/lib is for JARs
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]