O'Reilly logo

Core Servlets and JavaServer Pages™: Volume 1: Core Technologies, 2nd Edition by Larry Brown, Marty Hall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Generating the Server Response: HTTP Status Codes

Topics in This Chapter

  • Format of the HTTP response

  • How to set status codes

  • What the status codes are good for

  • Shortcut methods for redirection and error pages

  • A servlet that redirects users to browser-specific pages

  • A front end to various search engines

As we saw in the previous chapter, a request from a browser or other client consists of an HTTP command (usually GET or POST), zero or more request headers (one or more in HTTP 1.1, since Host is required), a blank line, and, only in the case of POST requests, some query data. A typical request looks like the following.

GET /servlet/SomeName HTTP/1.1
Host: ...
Header2: ...
...
HeaderN:
  (Blank Line)

When a Web server responds to a request, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required