Web container configuration for JavaServer Pages static file access

The web container searches for static files and JavaServer Pages (JSP) files in up to four different locations, depending on application configuration. This search is relevant to finding the appropriate resource to serve an inbound request and for results returned from the following APIs:
URL ServletContext.getResource(String path)
Set ServletContext.getResourcePaths(String path) 
Attention: Static files are only searched when the fileServing property is enabled and the application does not include a /* servlet mapping. Also, JSP files include files with the following extensions, in addition to any other patterns that are defined in the web.xml file
  • .jsp
  • .jspx
  • .jsw
  • .jsv
The four locations, in priority order, are as follows:
Application WAR directory
The web container first searches the application WAR directory for a requested resource. However, you cannot serve resources under the WEB-INF or META-INF directories for inbound requests, although they are accessible using the getResource() and getResourcePaths() methods.
Pre-fragment document roots
The web container searches any application defined pre-fragment document roots second. Define a pre-fragment document root in the ibm-web-ext.xmi file, located in the WEB-INF directory for the application. Define a pre-fragment document root for static files or JSP files, as follows:
Static files:
<fileServingAttributes xmi:id="<user-provided name>"
 name="preFragmentExtendedDocumentRoot"
 value="<user provided value>"/>
JSP files:
<jspAttributes xmi:id="<user provided name>" name="preFragmentExtendedDocumentRoot"
 value=<user provided value>"/> 
The <user provided name> can be a list of directories and/or a list of jars. For example:
<fileServingAttributes name="extendedDocumentRoot"
      value="C:\EDR_directory,C:\my\path\to\jarEDR.jar"/>
If the <user provided name> contains only a list of a directory and that directory contains jar files, it does not search inside those jar files. It searches for static files and JSP files inside that directory only, but outside any jar files. If the static or JSP files are in a jar, the static or jsp files cannot be inside the META-INF folder of the jar file as it is a restricted folder, and the <user provided name> should contain a full path to the jar file.
Attention: Pre-fragment document roots is a new function in WebSphere® Application Server Version 8.5.
META-INF/resources directories of fragments under the WEB-INF/Lib directory in the application WAR file
After searching pre-fragment document roots, the web container searches web fragments. A web fragment comprises a JAR file in an application WEB-INF/lib directory. The JAR might include static resources in a META-INF/resources directory that are defined within the JAR file. To prevent the web container from searching META-INF/resources directories, set the com.ibm.ws.webcontainer.SkipMetaInfResourcesProcessing web container custom property to true. The default value for the custom property is false.
com.ibm.ws.webcontainer.SkipMetaInfResourcesProcessing = true
Attention: META-INF/resources directories of fragments under the WEB-INF/Lib directory in the application WAR file is a new function in WebSphere Application Server Version 8.5.
Extended document roots
Finally, the web container searches any application defined as extended document roots. Extended document roots were available in previous releases and are defined in the ibm-web-ext.xmi file, which is located in the application WEB-INF directory. Define extended document root for static files or JSP files, as follows:
Static files:
<fileServingAttributes xmi:id="<user provided name>" name="extendedDocumentRoot"
 value="<user provided value>"/>
JSP files:
<jspAttributes xmi:id="<user provided name>" name="extendedDocumentRoot"
 value=<user provide value>"/>
com.ibm.ws.webcontainer.SkipMetaInfResourcesProcessing = true
The <user provided name> can be a list of directories and/or a list of jars. For example:
<fileServingAttributes name="extendedDocumentRoot"
      value="C:\EDR_directory,C:\my\path\to\jarEDR.jar"/>
If the <user provided name> contains only a list of a directory and that directory contains jar files, it does not search inside those jar files. It searches for static files and JSP files inside that directory only, but outside any jar files. If the static or JSP files are in a jar, the static or jsp files cannot be inside the META-INF folder of the jar file as it is a restricted folder, and the <user provided name> should contain a full path to the jar file.
Attention: You might set the com.ibm.ws.webcontainer.ServeWelcomeFileFromExtendedDocumentRoot custom property to true to enable serving static welcome pages from a static file extended document root. The default value for the custom property is false.
com.ibm.ws.webcontainer.ServeWelcomeFileFromExtendedDocumentRoot = true
When the com.ibm.ws.webcontainer.ServeWelcomeFileFromExtendedDocumentRoot property is set to true, the web container searches in a static file extended document root for a static welcome file to serve for a request comprising a valid partial URL. For example, if a request specifies only the application context, and a welcome file is specified as index.html, the property must be set if index.html is to be served from a static file extended document.
com.ibm.ws.webcontainer.enablepartialurltoextendeddocumentroot = true
The default value is false.

If this property is set to true, the web container includes the contents of a static file extended document root when determining whether an inbound request is for a valid partial URL. For example, if a request specifies a URL that ends with /<application context>/<text> and <text> does not map to a servlet or static file, the web container considers this URL a valid partial URL only if <text> is a valid directory of the application. As a result if directory <text> exists only in a static file extended document root, this property must be set for the URI to be considered a valid partial URI.

Important: These properties are not required for static file pre-fragment document roots. Also, when determining a valid partial URL, the web container does not consider JSP pre-fragment and extended document roots.