C.1 Manual Creation of a WAR file

A WAR file is a regular JAR file with a special directory structure. The root directory of the archive file serves as the document root for serving files that are part of the application. A special directory, WEB-INF, contains all servlet JAR files, class files, and resources.

/index.html

/logo.gif

/WEB-INF/lib/{JAR files used by servlet}

/WEB-INF/classes/{Class files used by servlet}

...

Mixing JAR files and class files may be problematic in some servlet runtime implementations. Therefore, we recommend packaging all class files into JAR files, and then placing them in the /WEB-INF/lib directory.

Once a WAR file is created, it can be deployed in a Servlet runtime environment. The actual procedure for deploying a WAR file is slightly different across different implementations. Detailed instructions for some typical environments appear in the next few chapters.

Example: WAR File Creation  >>

1. Create a root directory to hold the files. In this example, you create a directory in c:\temp called 'sree'.

2. Create the following sub-directories in c:\temp\sree:

WEB-INF\lib

WEB-INF\classes

3. Create an HTML entry screen in the root directory. As an example you can use the default login screen; simply copy the 'index.html' and 'logo.gif' files from the existing installation's webapps\sree and webapps\sree\images directories, respectively, and paste these files into the new c:\temp\sree directory.

4. Copy the SREE runtime JAR files to the c:\temp\sree\WEB-INF\lib directory. The required JAR files are:

sree.jar, or analogs:

   bisuite.jar

   visual.jar

   sree.jar

etools.jar

5. Create a JAR file to contain all of the replet class files in your report application. The JAR file should also contain all resource files, such as the report template XML files and the data files. For example, to create a JAR file for all of the replets in a given direc­tory, navigate to the desired directory, and then run the following:

jar cf guide.jar replets\*.class replets\*.srt replets\*.txt

6. Copy the replet JAR file guide.jar to c:\temp\sree\WEB-INF\lib.

7. Copy the configuration file, sree.properties, to c:\temp\sree\WEB-INF\classes.

8. Copy the repository.xml file to c:\temp\sree\WEB-INF\classes. The file name may be different depending on the property value of replet.repository.file in sree.properties.

9. If your application uses the default security implementation of SREE, copy both the acl.xml and passwd.xml files to c:\temp\sree\WEB-INF\classes. The file names may be different depending on the property values of security.password.file and security.acl.file.

10. Create a web.xml file in the WEB-INF directory. The web.xml file should be in standard web deployment descriptor format. The fol­lowing is an example of the descriptor file:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<servlet>

   <servlet-name>replets</servlet-name>

   <servlet-class>inetsoft.sree.web.ServletRepository</   servlet-class>

</servlet>

<servlet>

   <servlet-name>manager</servlet-name>

   <servlet-class>inetsoft.sree.adm.AdmServlet</servlet-   class>

</servlet>

<servlet>

   <servlet-name>DataServlet</servlet-name>

   <servlet-class>DataServlet</servlet-class>

</servlet>

 

<servlet-mapping>

   <servlet-name>replets</servlet-name>

   <url-pattern>/Reports</url-pattern>

</servlet-mapping>

<servlet-mapping>

   <servlet-name>manager</servlet-name>

   <url-pattern>/EnterpriseManager</url-pattern>

</servlet-mapping>

<servlet-mapping>

   <servlet-name>DataServlet</servlet-name>

   <url-pattern>/DataServlet</url-pattern>

</servlet-mapping>

</web-app>

11. Create the WAR file as follows:

cd c:\temp\sree

jar cf guide.war index.html logo.gif WEB-INF

These steps can be placed in a shell script or a makefile, and can then be performed as part of the application building process.

 

<< Appendix C: Manually Deploying a WAR File © 1996-2013 InetSoft Technology Corporation (v11.4) C.2 WebSphere 5.0 and higher >>