The following guidelines apply to deploying a web module in GlassFish Server:
Context Root. When you deploy a web module, if you do not specify a context root, the default is the name of the WAR file without the .war extension. The web module context root must be unique within the server.
Data Source. If a web application accesses a DataSource that is not specified in a resource-ref in sun-web.xml, or there is no sun-web.xml file, the resource-ref-name defined in web.xml is used. A warning message is logged, recording the JNDI name that was used to look up the resource.
Virtual Servers. If you deploy a web application and do not specify any assigned virtual servers, the web application is assigned to all currently-defined virtual servers with the exception of the virtual server with ID __asadmin, which is reserved for administrative purposes. If you then create additional virtual servers and want to assign existing web applications to them, you must redeploy the web applications.
HTTP Sessions. If a web application is undeployed, all its HTTP sessions will be invalidated and removed, unless the application is being undeployed as part of a redeployment and the keepSessions deployment property was set to true. See Example 2–7. During a server shutdown, all HTTP sessions of a web application will be persisted to the file specified by the session-manager property with name sessionFilename in the web application's sun-web.xml deployment descriptor. To prevent HTTP sessions from being persisted during a server shutdown, specify the sessionFilename property with an empty value, as follows:
<sun-web-app> <session-config> <session-manager> <manager-properties> <property name="sessionFilename" value="" /> </manager-properties> </session-manager> </session-config> </sun-web-app>
The default location where HTTP sessions will be persisted during a server shutdown is given as domain-dir/generated/jsp/module-name/module-name_SESSIONS.ser
JSP Precompilation. You can precompile JSP files during deployment by checking the appropriate box in the Administration Console, or by using the --precompilejsp option of the deploy subcommand. The GlassFish Server Ant tasks sun-appserv-deploy and sun-appserv-jspc also allow you to precompile JSP files. For more information, see Chapter 3, Using Ant with GlassFish Server, in Oracle GlassFish Server 3.0.1 Application Development Guide.
<sun-web-app> ... <jsp-config> <property name=keepgenerated value=true /> </jsp-config> </sun-web-app>
If you include this property when you deploy the WAR file, the generated source is kept in domain-dir/generated/jsp/module-name.
For more information about JSP precompilation, see jsp-config.
Web Context Parameters. You can set web context parameters after deployment. See the following sections:
Web Environment Entries. You can set web environment entries after deployment. See the following sections: