WAS v8.5 > Reference > Configuration file descriptions

Web container configuration for JSP static file access

The web container searches for static files and JSP (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) 

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

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, we 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> is a comma-separated list of directories that can include JAR or ZIP files from which static files or JSP files can be accessed. The list can be fully qualified or relative to the application ear directory. The attributes can be specified with identical values. Further, we can specify the same values by different applications.

Pre-fragment document roots is a new function in WebSphere Application Server v8.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.

META-INF/resources directories of fragments under the WEB-INF/Lib directory in the application WAR file is a new function in WAS v8.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, 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>"/>

The <user provided name> is a comma-separated list of directories that can include JAR or ZIP files from which static files or JSP files can be accessed. The list can be fully qualified, or relative to the application EAR directory. We can specify both attributes with identical values. Also, different applications can specify the same values.

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.

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

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.


Related concepts:

JSP class file generation
Packages and directories for generated .java and .class files
JSP batch compilation
Global tag libraries (deprecated)
Web fragments


+

Search Tips   |   Advanced Search