Working With Requests
Introduction
This chapter presents focused discussions of topics related to requests. The organization of the chapter loosely follows the typical order in which the servlet container and a servlet process the request. The chapter describes each task in isolation. See Chapter 9, Creating Servlets, for an example of a complete servlet.
A request arrives at the servlet through the process discussed in Understanding Request Routing. The servlet may inspect the headers of the request (Inspecting HTTP Headers). The servlet then interprets the content of the request, which is often contained in either parameters from an HTML form (Reading Parameters From a Form) or in a SOAP message. Servlets that rely on maintaining state between requests most often let the servlet container manage state using sessions (Recovering Session State). Servlets can also store state on the client using cookies (Managing State on the Client with Cookies).
This chapter follows the conventions that request is a rwsf::HttpServletRequest object, that response is a rwsf::HttpServletResponse object and that any standalone lines of code occur within a servlet function such as doPost().