O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

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

What is the HTTP protocol?

HTTP runs on top of TCP/IP. If you’re not familiar with those networking protocols, here’s the crash course: TCP is responsible for making sure that a file sent from one network node to another ends up as a complete file at the destination, even though the file is split into chunks when it’s sent. IP is the underlying protocol that moves/routes the chunks (packets) from one host to another on their way to the destination. HTTP, then, is another network protocol that has Web-specific features, but it depends on TCP/IP to get the complete request and response from one place to another. The structure of an HTTP conversation is a simple Request/Response sequence; a browser requests, and a server responds.

Note

Key elements of the request stream:

  • HTTP method (the action to be performed)

  • The page to access (a URL)

  • Form parameters (like arguments to a method)

image with no caption

Note

Key elements of the response stream:

  • A status code (for whether the request was successful)

  • Content-type (text, picture, HTML, etc.)

  • The content (the actual HTML, image, etc.)

Relax

You don’t have to memorize the HTTP spec.

The HTTP protocol is an IETF standard, RFC 2616. If you care. (Fortunately, the exam doesn’t expect you to.) Apache is an example of a Web server that processes HTTP requests. Mozilla is an example of a Web browser that provides the user with the means to make HTTP requests and to view the documents returned by the server.

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