Interface WebResourceRoot

All Superinterfaces:
Lifecycle
All Known Implementing Classes:
ExtractingRoot, StandardRoot

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's 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's 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.