Deploy-Time Web Application creation

Contents

Dynamically creating web applications at deployment time

There is no reason why web.xml and WAR files need to be created at build time, other than the belief that the WAR file format is a valid form for a redistributable Java Web application.

If the files are created (somehow) immediately prior to deploying the application, the WAR application can be targeted at a specific installation.

The main problem here is tooling: the target installation needs a product that can generate a web.xml file and WAR file on demand. Apache Ant can do this. SmartFrog can, although it is not something we have explicitly implemented. The sf-xml package can generate/edit and validate XML files, while Java's own jar command can be used to build a new WAR file, or patch an existing one.

Some application installers -those that provide web applications for third parties- effectively follow this route, with the GUI asking the user questions that are then used to either tune a web.xml file, or generate other configuration files.

Features

  • A tool on the target system dynamically creates a target-specific web.xml file, and hence WAR file/web application. This can be done immediately prior to deployment, or during an installation process.
  • application specific configuration files can be created in the same process.

Advantages

  • Generates custom web applications for specific installations.
  • Ensures that the wrong installation is not deployed on the wrong system.
  • A GUI can present options to the individual installing the application.

Disadvantages

  • Needs software on the target system to create the custom web application.
  • WAR files can no longer be used as distribution artifacts
  • The custom configuration information needs to be managed. If it is derived from the local system automatically (e.g. IP Address), there should be no problem replicating it. If entered manually, there is a risk that incorrect values can be entered.
  • If a GUI is used to enter values/install the WAR file, deployment cannot be automated or replicated.

SmartFrog support

This could be done via SmartFrog's Ant components, or by executing jar directly. The hard part is creating the web.xml file itself. Our sf-xml package provides some support to building a well-formed and valid XML document.

Get SmartFrog at SourceForge.net. Fast, secure and Free Open Source software downloads