Web Development with JavaServer Pages

Скачать в pdf «Web Development with JavaServer Pages»

GET Request

GET url HTTP/1.1


Information about the request

Just like HTTP responses, HTTP requests can be broken up into headers and bodies. However, while most HTTP response messages contain a body, many HTTP requests do not. A simple type of HTTP request just asks for information identified by a URL. (To be more specific, browsers don’t send the entire URL to servers; they send only the portion of the URL relative to the server’s root. When we discuss URLs in HTTP requests, we refer to this type of relative URL.) This kind of request usually consists of a line of text indicating the desired URL, along with some headers (
figure 2.4). Because such requests support simple information retrieval, they are called GET requests.

Handling GET requests is relatively simple: the server reads and parses the requested URL and sends an appropriate response. GET methods are often used to

retrieve simple files, such as static HTML or images. However, they are not limited to this simple functionality. URLs come in many shapes and sizes, and as we’ve discussed, servers have discretion in processing them: URLs don’t necessarily map to files in a filesystem, JSP pages, or anything else. Furthermore, information can be encoded dynamically into a URL. For example, a value you type into an HTML form might be added to the end of a URL. A web server can process this information on the fly, taking customized action depending on the information that a URL contains.

Скачать в pdf «Web Development with JavaServer Pages»