At Agent startup, the servlet container loads, initializes, and deploys the servlets so they are ready and waiting for requests. When a request arrives, it enters the Agent through the connectors, which pass it to the Agent's handler chain. If the request is a servlet, it is passed to the servlet handler, then on to the servlet container. The container then translates the request into C++ objects and passes it to the proper servlet. The servlet processes the request and returns a response to the handler chain, which passes it back up to the Agent's connectors and back to the requestor.
The servlet container is designed to perform well while serving large numbers of requests. A container can hold any number of active servlets, filters, listeners, or named objects. Both the container and the objects in it are multithreaded. The servlet container creates and manages threads as necessary to handle incoming requests. The container handles multiple requests concurrently, and more than one thread may enter an object at a time. Therefore, each object within a servlet container must be threadsafe.
Figure 1 presents a diagram of a running container. In the diagram, the servlet container has a single network connector. The container manages two contexts, each of which contains a number of objects.
Servlet requests are received through the connectors in the HydraExpress message transport layer. A servlet need not interact with the network itself. The Agent connectors handle the details of the network connection. The servlet container handles the necessary translation of the incoming message data format to the C++ objects needed by the servlet.
For a detailed discussion on connectors, see Section 5.2, "Creating a Custom Connector," in the HydraExpress User's Guide.
The servlet container can manage any number of distinct applications. An application c++ consists of any number of servlets, filters, listeners, and static Web pages. A set of components working together is a web application. HydraExpress does not directly represent the concept of a Web application. Instead, the servlet container uses a context to group related components. The container loads the objects within a context as a group, and objects within the same context can easily share data. Therefore, each context usually corresponds to a distinct Web application.
The HydraExpress command line must provide the location of a directory that holds descriptions of the servlets, listeners, and filters that the servlet container loads. At servlet execution runtime, all servlet context directories must be deployed to the servlet deployment directory, <installdir>\apps\servlets. Each directory within the servlets directory defines a context. The name of the context directory is the name of the context and determines the path to the servlets within the context. Each context directory contains a WEB-INF directory, and may also contain files related to the application. Each WEB-INF directory contains a web.xml file. The web.xml file describes the configuration of the context and the servlets, filters, and listeners that occupy the context.
For example, the directory structure below describes two contexts, one named orders and one named catalog. The catalog context contains a static HTML page, intro.html.
hydra-agent-express-installdir \apps \servlets \orders \WEB-INF web.xml \catalog intro.html \WEB-INF web.xml
If the HydraExpress Agent is at http://example.com, an HTML page at <installdir>\apps\servlets\catalog\intro.html appears at the URL http://example.com/servlets/catalog/intro.html. Likewise, servlets defined in the <installdir>\apps\servlets\orders\WEB-INF\web.xml file appear at URLs underneath http://example.com/orders.
For details on creating contexts and deploying servlets within contexts, see Chapter 4, "Configuring Objects in the Servlet Container."
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.