190 likes | 411 Views
Web Archive Deployment Descriptor. 4.1.0.3. Unit objectives. After completing this unit, you should be able to: Use the Application Developer deployment descriptor editor to configure Web components within a Web module Define welcome and error pages for your Web module
E N D
Unit objectives After completing this unit, you should be able to: • Use the Application Developer deployment descriptor editor to configure Web components within a Web module • Define welcome and error pages for your Web module • Have a better idea about the various elements of the Web deployment descriptor (web.xml)
WAR File • The Java Servlet 2.2 specification introduced the Web application archive • A Web archive (WAR) file is a packaged Web application • A Web application is a group of HTML pages, JSP pages, servlets, and other resources • WAR files also include a Web deployment descriptor file, web.xml, which describes the Web module
Web Deployment Descriptor Editor (Pages) • Welcome Pages • Login • Error Pages and Java Exception Types
Web Deployment Descriptor Editor (Servlets) • Details • URL Mapping • Initialization • Load on Startup • Security Role Refs • Run As • Icons • WebSphere Extensions • Markup Language • Global Transaction • Local Transaction
Web Deployment Descriptor Editor (Security) • Security Roles • Security Constraints
Web Deployment Descriptor Editor (Filters) • Details • Mappings • URL • Servlet • Initialization • Icons
Web Deployment Descriptor (References) • Define references to: • EJBs and Web services • External resources • Message destinations • Administered objects • DistributedMap • Queue • Topic • DataSource
Web Deployment Descriptor Editor (Extensions) • WebSphere only extensions
Web Deployment Descriptor Editor (Source) <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4"…> <display-name>CS01 Web Module</display-name> <servlet> <display-name>Command Servlet</display-name> <servlet-name>CommandServlet</servlet-name> <servlet-class> com.ibm.servlet.CommandProcessingServlet </servlet-class> <init-param> <param-name>controller</param-name> <param-value> com.ibm.exam.controller.ExamHttpController </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>CommandServlet</servlet-name> <url-pattern>ExamCommand</url-pattern> </servlet-mapping> … </web-app>
Variables Add or remove: Environment variables Tag lib references Message destinations Context parameters MIME Mappings Local encoding mappings JSP property groups Web Services pages WS Handler WS Extensions Web service client security extensions WS Bindings Web service client bindings Other Web Deployment Descriptor Editor Pages
Unit Summary • This unit looked at configuring the Web archive deployment descriptor (web.xml) using the specialized editor supplied with Application Developer.
Checkpoint • How do you register a servlet in a J2EE Web application? • What does load on startup mean? • What triggers can you configure to invoke an error page?
Checkpoint solutions • Servlets are declared as Web components in the web.xml deployment descriptor. • To load a servlet at start-up accomplishes two things. First, servlets that have an involved initialization can be ready to go when the first request for them is made. Second, by permitting the specification of load order, it is possible to configure a servlet whose principal task is to initialize the JVM, for example, by loading JDBC drivers. • Error pages can be triggered on a particular status code or Exception.
Unit summary Having completed this unit, you should be able to: • Use the Application Developer deployment descriptor editor to configure Web components within a Web module • Define welcome and error pages for your Web module • Have a better idea about the various elements of the Web deployment descriptor (web.xml)