views:

165

answers:

2

We work with IBM products and we typically use IBM Http Servers (read Apache) as a reverse proxy for our application servers. For performance reasons we serve static content (.gif, .jpg, .css, .html etc.) from our http servers, to ease the burden a bit from the application server.

So far, we have to distribute files to http server and configure it manually (writing custom scripts at best.) The problem is the effort needed to keep everything in synch, especially when you need to update the app.

Does any J2EE product support this “out of the box”? Is there a way to have application server do this automatically, like in cluster configuration for example, where master node is in charge of distributing the application to other nodes and for keeping everything in synch.

A: 

I'm not familiar with the IBM products, but a common practice is to deploy the applications (mostly WARs) as directories instead of war files so you can have access to the files themselves. Than, you map the deployment directory to an alias in the apache, so it can serve static content from there. Notice you need to block all access to the WEB-INF directory, and to route all requests to jsp files (.jsp, .jsf, .do, .action, etc.) to the application server.

Blocking WEB-INF is done using the following directive:

<DirectoryMatch "(WEB-INF|META-INF)">  
  Order allow,deny 
  Deny from all 
  AllowOverride None 
</DirectoryMatch>
David Rabinowitz
A: 

So far, we have to distribute files to http server and configure it manually (writing custom scripts at best.)

Not sure I get the configuration part. It usually pretty easy to distinguish static content from JSPs and Servlet (and once it has been done, it doesn't change that much).

The problem is the effort needed to keep everything in synch, especially when you need to update the app.

Automate! With Maven (or Ant, but this will require a bit more work), it is easy to create separate assemblies from a web project to handle this: a WAR for the J2EE nodes, a zip of static content for the HTTP servers.

Does any J2EE product support this “out of the box”?

AFAIK, no. Surprisingly, deployment is weak area of J2EE. But you can reach a decent level of automation with tools like Maven and/or ControlTier.

Pascal Thivent