PackagingDrafts/JavaWebApps

= Packaging Java Web Applications =

Web Application Archives
Web applications can be written in Java to be deployed on a Java web server (for example Tomcat and Jetty). These applications are bundled into what is referred to as a WAR file. Like a JAR file, a WAR file is similar to a zip archive and contains all data needed to run the application, this includes things like images, html pages, servlets, JAR files and configuration files.

The problem with WARs is that they contain JAR files which may already exist on the system. This means that JAR files would have to be maintained in multiple locations on the machine. Fortunately, most servers can use WAR files in an exploded format. This means that the WAR file is expanded into a directory structure instead of being an archive and we can symbolically link the JAR files as needed; e.g. package  which provides , the package would have:

webapps/%{name}/foo/ webapps/%{name}/foo/WEB-INF/lib/bar1.jar -> %{_javadir}/bar1.jar webapps/%{name}/foo/WEB-INF/lib/bar2.jar -> %{_javadir}/bar2.jar

Server independent part
According to existing practice, the web application data should be placed to. The package can contain more than a single web application -- it can contain a GUI or CLI application, either of them possibly using %{_datadir}/%{name}, or multiple web applications. A web application is possibly named differently from the package. Therefore use of %{_datadir}/%{_name} should be avoided.

A suitable name, what would prevent all sorts of naming conflicts would be. Note that the name  was chosen after existing naming practice of Tomcat. stands for name of the web application archive stripped of  suffix, since it's no longer an archive.

The configuration files should not go to, but rather in  , and be symbolically linked to where the web application expects it.

Server dependent deployment
Deployment is done by symbolically linking the directory with unpacked web application into server's webapps directory.

Example
To be written

Random notes
Fedora 9's  will probably not be able to create symlinks. Would it be okay if we either choose the  way or tolerated absolute links until Fedora 10, and add the feature  until then.

There are other java web archives such as EARs, SARs, HARs, CARs, ... which deal with Java Enterprise Edition (JEE) Application Servers. These will need to be treated in the same manner as WARs. A section will be available here once a JEE server is available in Fedora.