A descriptor based on XML is used in the deployment of servlets on a Web server. The compiled servlet class, additional supporting Java classes, and the deployment descriptor are packaged together into a Web archive file, also known as a “.war” file.
The deployment descriptor is an XML-based file that contains specific configuration and deployment information for use by the servlet container.
Figure 10-11 shows an example of a vanilla XML deployment descriptor for an HttpServlet. Additional required fields in the descriptor are filled in during configuration and deployment on the Web server.
<?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> <servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>LoginServlet</servlet-class> </servlet> </web-app> |
We discuss servlet deployment descriptors and Web archive files and their role in the context of modeling in Chapter 15.
52.15.38.176