Separating Static and Dynamic Content in Java EE Applications

We work with IBM products and we usually 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 load from the application server.

Until now, we have to distribute the files to the http server and configure it manually (at best, write our own scripts). The problem is the effort that needs to be kept in sync, especially when you need to update the app.

Does any Java EE product support this out of the box? Is there a way for the application server to do this automatically, for example in a cluster configuration where the master node is responsible for distributing the application to other nodes and for synchronizing.

+2


source to share


2 answers


Until now, we have to distribute the files to the http server and configure it manually (writing our own scripts at best).

Not sure if I will get some of the config. It's usually pretty easy to tell static content from JSP and Servlet (and once that was done it didn't change that much).

The problem lies in the effort it takes to keep everything in sync, especially when you need to update your app.



Automate! With Maven (or Ant , but it takes a little more work), it's easy to create separate assemblies from a web project to handle this: WAR for Java EE nodes, zip of static content for HTTP servers.

Does any Java EE product support this out of the box?

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

+2


source


I am not familiar with IBM products, but it is common practice to deploy applications (mostly WARs) as directories instead of military files so that you can access the files themselves. Then you map the deployment directory to an alias in apache so it can serve up static content. Please note that you need to block all access to the WEB-INF directory and redirect all requests for 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>

      

0


source







All Articles