Home > Articles

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

This chapter is from the book

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.

  • + Share This
  • 🔖 Save To Your Account