Chapter 4: Web Applications
Web applications contain several types of components.
Servlets are Java classes that create HTML pages with dynamic content and respond to requests from client applications that are implemented as HTML forms. Servlets also allow you to execute business logic from a Web browser or any other client application that connects using the Hypertext Transfer Protocol (HTTP). See Chapter 22, “Creating Java Servlets,” in the EAServer Programmer’s Guide.
Web clients invoke a Web application’s servlets by prepending the Web application’s root request path to an alias that is mapped to the servlet. For example, the following URL invokes a servlet mapped to the alias “Account” in the application with root request path “Finance”:
Servlets that are not part of a Web application are implicitly assigned to the EASDefault Web application. You can configure the properties for EASDefault the same as you do for other Web applications. See “The EASDefault Web application” in Chapter 21, “Creating Web Applications,” of the EAServer Programmer’s Guide.
JavaServer Pages (JSPs) allow you to embed snippets of Java code into HTML pages to create dynamic content. JSP tag libraries allow you to extend the standard HTML markup tags with custom tags backed by Java classes. See Chapter 24, “Creating JavaServer Pages,” in the EAServer Programmer’s Guide for more information on creating JSPs. If you have the PowerBuilder IDE, you can deploy JSP-based Web applications from PowerBuilder to EAServer. For more information, see Working with Web and JSP Targets in your PowerBuilder documentation.
You can include files that provide static content for the site in the Web site, including HTML, images, sounds, and so forth. You can also include Java applet files. You can configure the application’s deployment descriptor to specify security constraints for static files and any unique MIME types required by your content.
You must deploy static files to the following subdirectory in your EAServer installation directory:
Where web-app is the name of the Web application. You can include subdirectories, which are reflected in your application’s URL namespace.
If you import a Web archive (WAR) file, the importer expands the application’s static files to this location.
A Web application’s Java classes include the implementation class for each servlet and JSP, and any server-side utility classes used by the servlets and JSPs.
EAServer uses a custom class loader to run a Web application’s servlets and classes referenced by servlet and JSP code. This feature allows hot refresh of servlets and JSPs. The custom class loader also allows each Web application to run with its own effective Java class path.
EAServer also supports class sharing among components and servlets. You can configure custom class lists for components, Web applications, J2EE applications, or a server process. The custom list allows you to support hot refresh of the implementation, and limit the number of copies of shared classes that are loaded into server memory. For example, if a Web application calls an EJB component, you can configure the component and the Web application to share instances of the component stub classes and common utility classes. See Chapter 30, “Configuring Custom Java Class Lists,” in the EAServer Programmer’s Guide.
The application’s deployment descriptor catalogs the servlets, JSPs, and files contained in the application, as well as the properties of each. The descriptor must be formatted in XML, using the DTD specified in the Java Servlet Specification Version 2.3. You can create a descriptor using EAServer Manager or another J2EE-compliant development tool.
|Copyright © 2005. Sybase Inc. All rights reserved.|