Section 2.1. The Servlet Container

2.1. The Servlet Container

The servlet container is the core J2EE technology that powers the web tier. It is considered a container because JSPs and servlets cannot run as standalone applicationsthey must implement special interfaces and run "inside" the container. The container listens for HTTP requests on a given port, hands the incoming data to your custom components, and uses the resulting output to create a well-formed HTML document to return to the web browser as the response.

The JBoss developers wisely chose not to create their own servlet container to meet this need. A number of excellent ones already are out there. Rather than recreating the wheel, JBoss allows you to integrate the servlet container of your choice.

Tomcat 5.5.9 is the default servlet container included with JBoss 4.0.2. It is deployed as a SAR in $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar.

If you are comfortable working with Tomcat, you should have no trouble working in JBoss. All the usual configuration files and JARs are in the Tomcat directory. For example, edit server.xml to change the port Tomcat listens on. (8080 is the default.) To change the default session timeout from 30 minutes, edit conf/web.xml. (For more information about installing and configuring Tomcat, see Tomcat: The Definitive Guide by Jason Brittain and Ian F. Darwin (O'Reilly).)

Thanks to the modular design of JBoss, swapping out Tomcat for another servlet container is easy. Jetty is another option that is fast, mature, and open source. (As a matter of fact, it was the default container included with JBoss 3.x.) Go to to download a pre-built SAR, ready to drop in and run.

JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: