Sun Java System Web Server 6.1 SP6 Programmer's Guide to Web Applications

General Elements

General elements are as follows:

sun-web-app

Defines Sun Java System Web Server-specific configuration for a web application. This is the root element; there can only be one sun-web-app element in a sun-web.xml file.

Subelements

The following table describes subelements for the sun-web-app element. The left column lists the subelement name, the middle column indicates the requirement rule, and the right column describes what the element does.

Table 6–5 sun-web-app Subelements

Element  

Required  

Description  

sun-web-appsun-web-app

zero or more 

Maps roles to users or groups in the currently active realm. 

servletservlet

zero or more 

Specifies a principal name for a servlet, which is used for the run-as role defined in web.xml.

session-config

zero or one 

Specifies session manager, session cookie, and other session-related information. 

resource-env-ref

zero or more 

Maps the absolute JNDI name to the resource-env-ref in the corresponding J2SE XML file.

resource-ref

zero or more 

Maps the absolute JNDI name to the resource-ref in the corresponding J2SE XML file.

cache

zero or one 

Configures caching for web application components. 

class-loader

zero or one 

Specifies classloader configuration information. 

jsp-config

zero or one 

Specifies JSP configuration information. 

locale-charset-info

zero or one 

Specifies internationalization settings. 

propertyproperty

zero or more 

Specifies a property, which contains a name and a value. 

Attributes

none

Properties

The following table describes properties for the sun-web-app element. The left column lists the property name, the middle column indicates the default value, and the right column describes what the property does.

Table 6–6 sun-web-app Properties

Property Name  

Default Value  

Description  

crossContextAllowed

true

If true, allows this web application to access the contexts of other web applications using the ServletContext.getContext() method.

encodeCookies

true

If true, Sun Java System Web Server URL encodes cookies before sending them to the client. If you do not want cookies to be encoded, add the following to sun-web.xml:

<property name="encodeCookies" value="false">

For the above example, enter the line directly under the <sun-web-app> tag; do not embed this in any other tag.

tempdir

instance_dir/ClassCache/vs_id/uri

Specifies a temporary directory for use by this web application. This value is used to construct the value of the javax.servlet.context.tempdir context attribute. Compiled JSPs are also placed in this directory.

singleThreadedServletPoolSize

5

Specifies the maximum number of servlet instances allocated for each SingleThreadModel servlet in the web application.

reuseSessionID

false

If true, this property causes the web application to reuse the JSESSIONID value (if present) in the request header as the session ID when creating sessions. The default behavior of web applications is to not reuse session IDs and instead generate cryptographically random session IDs for new sessions.

relativeRedirectAllowed

false

If true, allows the web application to send a relative URL to the client using the HttpServletResponse.sendRedirect() API (that is, it suppresses the container from translating a relative URL to a fully qualified URL).

property

Specifies a property, which contains a name and a value. A property adds configuration information to its parent element that is one or both of the following:

For example, a manager-properties element can include property subelements:

<manager-properties>
        <property name="reapIntervalSeconds" value="20" >
     </manager-properties>

Which properties a manager-properties element uses depends on the value of the parent session-manager element's persistence-type attribute. For details, see the description of the session-manager element.

Subelements

The following table describes subelements for the property element. The left column lists the subelement name, the middle column indicates the requirement rule, and the right column describes what the element does.

Table 6–7 property Subelements

Element  

Required  

Description  

description

zero or one 

Contains a text description of this element. 

Attributes

The following table describes attributes for the property element. The left column lists the attribute name, the middle column indicates the default value, and the right column describes what the attribute does.

Table 6–8 property Attributes

Attribute  

Default  

Description  

name

none 

Specifies the name of the property or variable. 

value

none 

Specifies the value of the property or variable. 

description

Contains a text description of the parent element.

Subelements

none

Attributes

none