- 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
- Summary
Summary
This chapter has supplied you with the information required to work with HTTP requests and responses. You have seen that HTTP is the synchronous and stateless TCP/IP protocol that underpins Web servers. Web servers respond to Web client requests and return information in the body of the HTTP response. The two most common forms of requests are GET and POST. GET requests are used for simple Web pages, or Web forms containing a small amount of data. POST requests are used for Web forms that can send a lot of data (typically more than 255 characters).
HTTP requests and responses contain header fields that are used to pass additional information between the client and server. The HTTP body is used in a request to pass additional information to the server (such as the parameters in a POST request), and in the server response to return the requested Web page data.
You have also learned how the java.net.URL and java.net.URLConnection classes can be used within a Java application to send an HTTP request to a server and read the response.