The Jakarta Project
    The Tomcat Servlet/JSP Container

Links

Top Level Elements

Connectors

Containers

Nested Components

Server Configuration Reference

The Resources Component

Printer Friendly Version
print-friendly
version
Introduction

The Resources element represents the web application static resources, from which classes will be loaded, HTML, JSP and the other static files will be served. This allows the webapp to reside on various mediums other than the filesystem, like compressed in a WAR file, in a JDBC database, or in a more advanced versioning repository.

A unified caching engine is provided for all accesses to the webapp resources made by the servlet container and web applications which use the container provided mechanisms to access such resources, such as class laoder access, access through the ServletContext interface, or native access through the DirectoryContext interface.

Note: Running a webapp with non-filesystem based Resources implementations is only possible when the webapp does not rely on direct filesystem access to its own resources, and uses the methods in the ServletContext interface to access them.

A Resources element MAY be nested inside a Context component. If it is not included, a default filesystem based Resources will be created automatically, which is sufficient for most requirements.

Attributes
Common Attributes

All implementations of Resources support the following attributes:

AttributeDescription
className

Java class name of the implementation to use. This class must implement the javax.naming.directory.DirContext interface. It is recommended for optimal functionality and performance, but not mandatory, that the class extend org.apache.naming.resources.BaseDirContext, as well as use the special object types provided in the org.apache.naming.resources for returned objects. If not specified, the standard value (defined below) will be used.

Standard Implementation

The standard implementation of Resources is org.apache.naming.resources.FileDirContext. It supports the following additional attributes (in addition to the common attributes listed above):

AttributeDescription
allowLinking

If the value of this flag is true, symlinks will be allowed inside the web application, pointing to resources outside the web application base path. If not specified, the default value of the flag is false.

NOTE: This flag MUST NOT be set to true on the Windows platform (or any other OS which does not have a case sensitive filesystem), as it will disable case sensitivity checks, allowing JSP source code disclosure, among other security problems.

cached

This boolean flag indicates if the resources should be cached. It defaults to true.

cacheMaxSize

Maximum size in kilobytes (KB) of the cache associated with the resources, if cached is set to true. It defaults to 10240 (10 megabytes).

cacheTTL

Amount of time in milliseconds between cache entries revalidation. If not specified, the default value is 5000 (5 seconds).

caseSensitive

This boolean flag toggles case sensitivity checks. Defaults to true.

NOTE: This flag MUST NOT be set to false on the Windows platform (or any other OS which does not have a case sensitive filesystem), as it will disable case sensitivity checks, allowing JSP source code disclosure, among other security problems.

docBase

This is the functional equivalent to the Document Base of a Context.

Nested Components

No components may be nested inside a Resources element.

Special Features

No special features are associated with a Resources element.


Copyright © 1999-2003, Apache Software Foundation