![]() |
![]() |
Building the MedRec Applications
Tutorial 8: Walkthrough of Web Application Deployment Descriptors
This tutorial examines the deployment descriptor files that define the resources and operating attributes of the MedRec Web applications.
Like most WebLogic Server Web Applications, each MedRec Web application uses two deployment descriptor files, web.xml and weblogic.xml. These files reside in the WEB-INF folders that are part of the directory structure of WebLogic Server Web Applications.
A web.xml deployment descriptor file is a J2EE standard XML document that sets properties for a Web Application. These properties are defined by the DTD referenced in a heading in each web.xml file, at http://java.sun.com/dtd/web-app_2_3.dtd.
A weblogic.xml deployment descriptor file is an XML document that defines WebLogic Server-specific properties for Web applications. These properties are defined by the DTD at http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd.
The tutorial includes the following sections:
|
Prerequisites
Before starting this tutorial:
|
Procedure
The following procedure walks you through the contents of the web.xml and weblogic.xml files.
Step 1: Examine a web.xml file.
In this section, examine how the web.xml file from mainWebApp configures mainWebApp's resources. mainWebApp responds to HTTP requests in MedRec, either creating HTTP responses or forwarding requests to other Web components.
web.xml can define following attributes for a Web Application:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
Use caution with this section of the file, as erroneous edits here will likely prevent the application from being deployed until they are corrected.
The following listing names a servlet called "action," and associates it with a class:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servle t-class>
See web.xml Deployment Descriptor Elements in Developing Web Applications for WebLogic Server.
Step 2: Examine a weblogic.xml File
In this section, examine the contents of the weblogic.xml file that configures the physicianWebApp. Physicians and nurses log in to the physician Web Application to search and access patient profiles, create and review patient medical records, and prescribe medicine to patients.
A WebLogic Server Web Application's weblogic.xml file can set, among other things, the following major properties:
<!DOCTYPE weblogic-web-app
PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN"
"http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd" >
<weblogic-web-app>
....
</weblogic-web-app>
For example, the InvalidationIntervalSecs parameter is a performance-related setting that specifies the number of seconds the server waits before checking to determine if a session is invalid or has timed out.
The next parameter, TimeoutSecs, sets the number of seconds the server waits before timing out a session.
The value assigned to the third parameter, PersistentStoreType, determines the persistent store method for servlet sessions. The current value, replicated_if_clustered, means that sessions on this server are stored in accordance with the value set for the cluster of servers to which this server belongs—if the Web Application is deployed to a cluster. Absent a clustered server configuration, servlet sessions default to the memory PersistentStoreType, in which sessions are not stored persistently.
<session-descriptor>
<session-param>
<param-name>InvalidationIntervalSecs</param-name>
<param-value>60</param-value>
</session-param>
<session-param>
<param-name>TimeoutSecs</param-name>
<param-value>600</param-value>
</session-param>
<session-param>
<param-name>PersistentStoreType</param-name>
<param-value>replicated_if_clustered</param-value>
</session-param>
</session-descriptor>
<virtual-directory-mapping>
<local-path>C:/bea/weblogic81/samples/server/medrec/src/comm on/web</local-path>
<url-pattern>images/*</url-pattern>
</virtual-directory-mapping>
The setting physician means that users access the physicianWebApp when they specifically request it.
<context-root>physician</context-root>
See weblogic.xml Deployment Descriptor Elements in Developing Web Applications for WebLogic Server.
|
Best Practices
|
The Big Picture
The MedRec application contains five Web Applications:
The resources and attributes of these Web Applications are defined by deployment descriptor files. This tutorial describes the function of these deployment descriptors, specifically web.xml, the standard J2EE Web application deployment descriptor file, and weblogic.xml, the WebLogic Server-specific Web application deployment descriptor file.
Deployment descriptor files configure properties for MedRec's applications and EJBs, as well as its Web applications.
For example, physicianEar, the application to which physicianWebApp belongs, also contains a session EJB component, physSessionEJBs. physSessionEJBs's deployment descriptor files, located at C:\medrec_tutorial\build\physicianEar\physSessionEjbs\META-INF, are the standard J2EE EJB deployment descriptor file ejb-jar.xml, and the WebLogic Server-specific EJB deployment descriptor file, weblogic-ejb-jar.xml.
medrecEar, the main MedRec application, is configured by a standard J2EE application deployment descriptor file, application.xml, located at C:\medrec_tutorial\src\medrecEar\META-INF.
You are encouraged to examine the EJB and application deployment descriptor files and the DTD files that they reference.
|
Related Reading
![]() |
![]() |
![]() |