2006/1/25, Renat Lumpau <rl03@gentoo.org>:
Hello,
I am looking into making webapp-config Java-aware. While there are quite a few
things that would need to happen from both the w-c and Java ends, it definitely
seems plausible.
The first step is to develop a directory structure for Java webapps that
supports virtual hosts and plays nice with GLEP 11.
I'm not sure this is the right way to go... The standard way to deploy a J2EE application (wether web or more than web, this is containing EJBs and other stuff) is using an enterprise application archive. This is basically a jar file with .ear extension and with its content arranged in a specified way. In the case of pure web applications (only servlets/JSPs) you may use directly a web archive, this is a jar file with .war extension and again with its contents arranged in a specified way. Some containers provide support for deploying an exploded (unzipped, unjarred, whatever you call it) application, but I think this is not dictated by the standard, so you can't count on this. Once you deploy the application, it's up to the server to do whatever it wants to run the application: it could unzip (unjar) the application to a working directory, or maybe just work from the provided file, as long as it publishes the web application as the standard dictates.
Moreover, I'm not sure you could create virtual hosting based only on J2EE servers, as I don't remember this to be included in the J2EE standard, and again you can't count on it. I think the best way to do this would be to provide virtual hosting using Apache and then use some connector to forward requests to the corresponding J2EE server. As far as I know this can be done with Tomcat, Jetty and JBoss fro your list.
All four J2EE/servlet
engines currently in Portage (tomcat, jetty, resin, and jboss) implement this in
their own way:
- tomcat stores webapps in /var/lib/tomcat-5/{vhost}/webapps. There is
one "default" vhost.
- jetty stores webapps in /opt/jetty/webapps. There is currently no
vhost hierarchy, although I believe it should be easy to create one under
/opt/jetty/webapps/{vhost}
- resin stores webapps in /opt/resin/webapps. There is currently no
vhost hierarchy, although I believe it should be easy to create one under
/opt/resin/webapps/{vhost}
- jboss is less straightforward. It appears that webapps go into
/var/lib/jboss/{all,default,minimal}, but I'm not sure what the difference
between those three directories is or how vhosts are handled.
JBoss is thought as a microkernel to which you add containers and services as needed. In this case, each container (web, EJB) or service can be added or removed to create an instance of the server that suits your needs. JBoss comes with three configurations out of the box, one with all availables services activated, one as the default configuration used for most of the J2EE applications and one with a minimal set of services activated. Each of them has its own directory where all the necessary files for that configuration live.
I propose to add a Java-specific directory under /var/www/{vhost}, such as
/var/www/localhost/java (perhaps there is a better name than java?). This
directory could be symlinked from the tomcat/jetty/resin/jboss locations, much
like what tomcat already does. This would have the benefit of keeping everything
related to one vhost (statis HTML, servlets, CGI scripts, etc) in one location.
Comments and suggestions (esp. from Java folks) are welcome. I would
particularly like to figure out what to do with jboss.