Sun GlassFish Enterprise Server v3 Application Deployment Guide

sun-web-app

Defines Enterprise Server specific configuration for a web module. This is the root element; there can only be one sun-web-app element in a sun-web.xml file. See The sun-web.xml File.

Superelements

none

Subelements

The following table describes subelements for the sun-web-app element.

Table C–149 sun-web-app Subelements

Element 

Required 

Description 

context-root

zero or one 

Contains the web context root for the web module. 

security-role-mapping

zero or more 

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

servlet

zero or more 

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

idempotent-url-pattern

zero or more 

Specifies a URL pattern for idempotent requests. 

session-config

zero or one 

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

ejb-ref

zero or more 

Maps the absolute JNDI name to the ejb-ref in the corresponding Java EE XML file.

resource-ref

zero or more 

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

resource-env-ref

zero or more 

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

service-ref

zero or more 

Specifies runtime settings for a web service reference. 

message-destination-ref

zero or more 

Specifies the name of a physical message destination. 

cache

zero or one 

Configures caching for web application components. 

class-loader

zero or one 

Specifies class loader configuration information. 

jsp-config

zero or one 

Specifies JSP configuration information. 

locale-charset-info

zero or one 

Deprecated. Use the parameter-encoding subelement of sun-web-app instead.

parameter-encoding

zero or one 

Determines the default request character encoding and how the web container decodes parameters from forms according to a hidden field value. 

property (with attributes)

zero or more 

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

valve

zero or more 

Specifies a custom valve. 

message-destination

zero or more 

Specifies the name of a logical message destination. 

webservice-description

zero or more 

Specifies a name and optional publish location for a web service. 

Attributes

The following table describes attributes for the sun-web-app element.

Table C–150 sun-web-app Attributes

Attribute 

Default 

Description 

error-url

(blank) 

(optional) Not implemented. Do not use. 

httpservlet-security-provider

none 

(optional) Specifies the HttpServlet message layer provider that the web container's servlet auth-constraint processing calls.

Properties

The following table describes properties for the sun-web-app element.

Table C–151 sun-web-app Properties

Property  

Default  

Description  

allowLinking

false

If true, resources in this web application that are symbolic links are served. You can also define this property for a virtual server. Web applications on the virtual server that do not define this property use the virtual server's value. For details, see create-virtual-server(1).


Caution – Caution –

Setting this property to true on Windows systems exposes JSP source code.


alternatedocroot_n

none 

Specifies an alternate document root (docroot), where n is a positive integer that allows specification of more than one. Alternate docroots allow web applications to serve requests for certain resources from outside their own docroot, based on whether those requests match one (or more) of the URI patterns of the web application's alternate docroots.

If a request matches an alternate docroot's URI pattern, it is mapped to the alternate docroot by appending the request URI (minus the web application's context root) to the alternate docroot's physical location (directory). If a request matches multiple URI patterns, the alternate docroot is determined according to the following precedence order: 

  • Exact match

  • Longest path match

  • Extension match

For example, the following properties specify three alternate docroots. The URI pattern of the first alternate docroot uses an exact match, whereas the URI patterns of the second and third alternate docroots use extension and longest path prefix matches, respectively. 

<property name="alternatedocroot_1" 
   value="from=/my.jpg dir=/srv/images/jpg"/>
<property name="alternatedocroot_2" 
   value="from=*.jpg dir=/srv/images/jpg"/>
<property name="alternatedocroot_3" 
   value="from=/jpg/* dir=/src/images"/>

The value of each alternate docroot has two components: The first component, from, specifies the alternate docroot's URI pattern, and the second component, dir, specifies the alternate docroot's physical location (directory). Spaces are allowed in the dir component.

You can set this property for all the web applications on a specific virtual server. For details, see create-virtual-server(1).

valve_n

none 

This property is deprecated. Use the valve subelement instead.

Specifies a fully qualified class name of a custom valve, where n is a positive integer that allows specification of more than one. The valve class must implement the org.apache.catalina.Valve interface from Tomcat or previous Enterprise Server releases, or the org.glassfish.web.valve.GlassFishValve interface from the current Enterprise Server release. For example:

<property name="valve_1" 
   value="org.glassfish.extension.Valve"/>

You can set this property for all the web applications on a specific virtual server. For details, see create-virtual-server(1).

listener_n

none 

Specifies a fully qualified class name of a custom Catalina listener, where n is a positive integer that allows specification of more than one. The listener class must implement the org.apache.catalina.ContainerListener, org.apache.catalina.LifecycleListener, or org.apache.catalina.InstanceListener interface. For example:

<property name="listener_1" 
   value="org.glassfish.extension.MyLifecycleListener"/>

You can set this property for all the web applications on a specific virtual server. For details, see create-virtual-server(1).

crossContextAllowed

true

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

relativeRedirectAllowed

false

If true, allows this web application to send a relative URL to the client using HttpServletResponse.sendRedirect(), and instructs the web container not to translate any relative URLs to fully qualified ones.

reuseSessionID

false

If true, sessions generated for this web application use the session ID specified in the request.

securePagesWithPragma

true

Set this property to false to ensure that for this web application file downloads using SSL work properly in Internet Explorer.

You can set this property for all the web applications on a specific virtual server. For details, see create-virtual-server(1).

singleThreadedServletPoolSize

5

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

tempdir

domain-dir/generated/app-name

or 

domain-dir/generated/module-name

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

useResponseCTForHeaders

false

If true, response headers are encoded using the response’s charset instead of the default (UTF-8).