Table of Contents
Geronimo supports Servlet 2.4 / JSP 2.0 web applications, with backward compatibility for previous spec versions. Web applications have full access to application components and resources deployed at the application or server level, and may deploy custom resources at the module level as well.
Note | |
---|---|
Geronimo currently supports two web containers: Jetty and Tomcat. Each installation package supports one container or the other. The procedures and deployment plans in this chapter apply to both containers. |
Deploying Web Applications to Geronimo typically involves several steps:
Create the servlet classes, servlet filter classes, JSPs, and/or static content such as images, HTML, CSS, and JavaScript files.
Create the standard web.xml deployment descriptor
Create a Geronimo-specific geronimo-web.xml deployment plan
Package the web application and deployment descriptors into a WAR file, or a directory tree laid out like a WAR
Use the deployment tool described in Section 10.4, “The Deploy Tool” to deploy the WAR (or an EAR containing the WAR) into the server
The process of developing web applications and the standard web.xml deployment descriptor should be familiar already. After a brief review of what Geronimo expects from a WAR, this chapter focuses mainly on the contents of the Geronimo geronimo-web.xml deployment plan. This plan may be packaged within the web application WAR, or provided as a separate file in the EAR or to the deployment tool.
Geronimo doesn't have any special requirements on WAR files -- any WAR produced according to the standard J2EE process should work in Geronimo. However, there are a couple points to note:
Geronimo requires that every WAR file has a standard WEB-INF/web.xml deployment descriptor. This may be configured for Web App 2.2, Web App 2.3, or Web App 2.4, and should follow the appropriate XML format (see below).
If the WAR file is included in an application EAR, then the classes in the WAR will be able to access the classes in EJB JARs and J2EE Connector RARs in the EAR. Additionally, any classes in WEB-INF/classes and libraries in WEB-INF/lib will be included in the class path. Beyond that, external libraries can also be placed in the Geronimo server repository and referenced with dependency elements in the Geronimo deployment plan (see Section 11.3.1, “Customizing the Web Application Class Path”).
Geronimo expects the WEB-INF/web.xml file to obey one of the following standard formats:
Defined by the DTD at http://java.sun.com/j2ee/dtds/web-app_2_2.dtd, a Web App 2.2 deployment descriptor looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> <web-app> ... </web-app>
Defined by the DTD at http://java.sun.com/dtd/web-app_2_3.dtd, a Web App 2.3 deployment descriptor looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> ... </web-app>
Defined by the XML schema at http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd, a Web App 2.4 deployment descriptor looks like this:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> ... </web-app>