One of the most important concepts for understanding Web applications is to know how the client's request is processed and how responses are produced as the client needs it. When we covered the important components of the Web application earlier in the chapter, we learned that the J2EE platform provides multiple flavors of servlets to cater to different protocols. One of the most popular and widely used servlet types in the Web application model is based on the HTTP protocol. The Servlet specification provides the necessary infrastructure in terms of APIs and other services for implementing this type of servlet. We'll use this servlet type to understand the request-response model as implemented for Web applications and different parties involved in making this client-server conversation happen. We don't have to know much about the classes and APIs that make up the servlet infrastructure at this time. We'll go into that when we get to Chapter 14, “Writing WebLogic Server Servlets.”
The different parties involved in the HTTP-based request response model are as follows:
The Web browser that provides the runtime environment for the Web client
The Web server that listens to the incoming requests from different clients and also has the responsibility of serving some static resources, such as HTML pages
The application server with a Web container built into it
The Web applications that include components as described in Figure 6.2
Figure 6.3 describes the entire request-response cycle in HTTP-based servlets. With the help of Figure 6.3, let's look at the steps involved.
The Web server and the application server containing the Web applications need not be different processes. In the case of WebLogic Server, it serves as the Web server and as a J2EE-compliant application server with a built-in Web and EJB container, among other features. The Web browser is the most common client for Web applications, but the user is free to access the Web applications from other client types, including PDA, mobile, and so on. The Web application component should be enabled to deliver the response according to the client that sent the request.