JBoss, a division of Red HatJBoss.org - Community driven.
Docs Home
Config Ref. Home
Top Level Element
Web SubSystem
Configuration elements
Virtual Hosts
Printer Friendly Version

The Context Container


The Context element represents a web application, which is run within a particular virtual host. Each web application is based on a Web Application Archive (WAR) file, or a corresponding directory containing the corresponding unpacked contents, as described in the Servlet Specification (version 2.2 or later). For more information about web application archives, you can download the Servlet Specification, and review the JBoss Web Application Developer's Guide.

The web application used to process each HTTP request is selected by Catalina based on matching the longest possible prefix of the Request URI against the context path of each defined Context. Once selected, that Context will select an appropriate servlet to process the incoming request, according to the servlet mappings defined in the web application deployment descriptor file (which MUST be located at /WEB-INF/web.xml within the web app's directory hierarchy).

You may define as many Context elements as you wish. Each such Context MUST have a unique context path. In addition, a Context must be present with a context path equal to a zero-length string. This Context becomes the default web application for this virtual host, and is used to process all requests that do not match any other Context's context path.

In AS7 the file context.xml is ignored Most of the old context.xml configuration has been moved to jboss-web.xml (See jboss-web.xml).


Common Attributes

All implementations of Context support the following attributes:


This value represents the delay in seconds between the invocation of the backgroundProcess method on this context and its child containers, including all wrappers. Child containers will not be invoked if their delay value is not negative (which would mean they are using their own processing thread). Setting this to a positive value will cause a thread to be spawn. After waiting the specified amount of time, the thread will invoke the backgroundProcess method on this host and all its child containers. A context will use background processing to perform session expiration and class monitoring for reloading. The value of this attribut is 10 seconds.


Java class name of the implementation to use. This class must implement the org.apache.catalina.Context interface. org.apache.catalina.core.StandardContext is used.


To control the cookies use session-config in web.xml


Use disable-cross-context in jboss-web.xml

Set to false if you want calls within this application to ServletContext.getContext() to successfully return a request dispatcher for other web applications running on this virtual host. Set to true (the default) in security conscious environments, to make getContext() always return null.


Can't be changed in AS7


Not supported in AS7


Not supported in AS7


The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts. Use context-root in jboss-web.xml to configure that in AS7.


Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. In AS7 you can use use the deployment-scanner in standalone.xml or development in the jsp-configuration element inside the subsystem=web element.


Java class name of the org.apache.catalina.Wrapper implementation class that will be used for servlets managed by this Context. org.apache.catalina.core.StandardWrapper is used.

Standard Implementation

The standard implementation of Context is org.apache.catalina.core.StandardContext. It supports the following additional attributes (in addition to the common attributes listed above):


Actually not supported in AS7

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.


Not supported in AS7


Not supported in AS7


Maximum size of the static resource cache in kilobytes. The default value is 10240 (10 megabytes) is used in AS7.


Amount of time in milliseconds between cache entries revalidation. The default value is 5000 (5 seconds) is used in AS7.


If the value of this flag is true, the cache for static resources will be used. The default value true is used in AS7.


If the value of this flag is true, all case sensitivity checks will be disabled. If not specified, the default value of the flag is 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. The default value true is used in AS7.


Whether the context should process TLDs on startup. The default is true. The false setting is intended for special cases that know in advance TLDs are not part of the webapp. The default value true is used in AS7.


Not supported in AS7. The outputs go to server.log file


Not supported in AS7


Not supported in AS7


Not supported in AS7


Not supported in AS7

AS7 will unpack all compressed web applications before running them.


Not supported in AS7


Pathname to a scratch directory to be provided by this Context for temporary read-write use by servlets within the associated web application. This directory will be made visible to servlets in the web application by a servlet context attribute (of type java.io.File) named javax.servlet.context.tempdir as described in the Servlet Specification. In AS7 something like standalone/tmp/work/jboss.web is used.

Special Features


In AS7 most of the feature of context.xml are now in jboss-web.xml. See jboss-web.xml for more information.