Packaging Java Web Applications
A complete web application may consist of several different resources: JSP pages, servlets, applets, static HTML pages, custom tag libraries and other Java class files. Until very recently, different servers required an application with all these components to be installed and configured in different ways, making it very hard for web application developers to provide easy-to-use installation instructions and tools.
Version 2.2 of the servlet specification defines a portable way to
package all these resources together, along with a
deployment descriptor. A deployment descriptor
is a file that outlines security requirements and describes how all
the resources fit together. All files for the web application are
placed in an archive file, called a Web Archive (WAR) file. A WAR
file has a .war
file extension and can be
created with the Java jar
command or a ZIP
utility program such as WinZip
(the same
compression scheme is used).
All Servlet 2.2-compliant servers can install a WAR file and associate the application with a servlet context. During installation, a server is free to unpack the contents of the file and store it for runtime use in any way it sees fit, but the application developer needs to deal with only one delivery format. This standardized deployment format also enables server vendors to develop installation and configuration tools that make it easy to install a new web application.
The internal structure for a WAR file is defined by the JSP ...
Get Java Server Pages now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.