Chapter 6. GENERATING THE SERVER RESPONSE: HTTP STATUS CODES

Topics in This Chapter

  • The purpose of HTTP status codes

  • The way to specify status codes from servlets

  • The meaning of each of the HTTP 1.1 status code values

  • A servlet that uses status codes to redirect users to other sites and to report errors

When a Web server responds to a request from a browser or other Web client, the response typically consists of a status line, some response headers, a blank line, and the document. Here is a minimal example:

HTTP/1.1 200 OK
Content-Type: text/plain

Hello World

The status line consists of the HTTP version (HTTP/1.1 in the example above), a status code (an integer; 200 in the above example), and a very short message corresponding to the status code ...

Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.