Home > Articles

Basic Principles of Web Servers

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

In This Chapter

  • Hypertext Transfer Protocol

  • The Structure of an HTTP Message

  • The Structure of an HTTP Request

  • The Structure of an HTTP Response

  • Testing an HTTP Connection

  • Passing Request Parameters

  • Client Page Caching

  • URI Redirection and Page Refresh

  • Persistent Connections

  • Using HTTP from Within a Java Program

Web servers and clients communicate using the Hypertext Transfer Protocol (HTTP). To design and develop effective Web applications, you have to be able to write servlets and JSPs that access and configure the underlying HTTP communication. This chapter will discuss the general structure of HTTP requests and responses used to exchange information between the Web client and server.

This chapter is a quick overview of HTTP containing sufficient detail for you to work with servlets and JSPs. For detailed information about HTTP, you should study the relevant RFCs available from http://www.ietf.org. The two HTTP RFCs and an RFC defining a URI encoding mechanism are shown here:



RFC 1945

Hypertext Transfer Protocol—HTTP/1.0

RFC 2277

IETF Policy on Character Sets and Languages

RFC 2616

Hypertext Transfer Protocol—HTTP/1.1

Hypertext Transfer Protocol

The Hypertext Transfer Protocol (HTTP) is the underlying TCP/IP network protocol used by Web servers. HTTP is a synchronous protocol, which in this case means that after a client sends a request to a server, it waits for a single response. The server can only respond to requests. It cannot initiate a connection to the client.

HTTP is also a stateless protocol. Every request must therefore contain all the information required by the Web server to process the request. When, as is often the case, it is necessary for several HTTP requests to maintain state information, the client and server must use a session management technique (discussed in Chapter 8, "Session Tracking") to ensure that information can be traced to a particular client session.

As you will see in Chapter 4, "Basic Principles of Servlets," the supporting APIs for servlets hide many of the details on HTTP headers and responses presented in the following sections. However, you still need to know how HTTP works in order to write servlets that make the best use of the protocol.

  • + Share This
  • 🔖 Save To Your Account