Java socket support for HTTP client/server applications
An HTTP client will make a connection to an HTTP server. The client will send a request message to the server. The server will send back a response message, frequently, as an HTML document. In the early HTTP version, once the response was sent, the server would terminate the connection. This is sometimes referred to as a stateless protocol because the connection is not maintained.
With HTTP/1.1, persistent connections can be maintained. This improves the performance by eliminating the need to open and close connections when multiple pieces of data need to be transferred between the server and a client.
We will focus on creating an HTTP server and an HTTP client. While browsers typically serve as HTTP clients, other applications can also access web servers. In addition, it helps illustrate the nature of HTTP requests. Our server will support a subset of the HTTP/1.0 specification.
Building a simple HTTP server
We will use a class called...