9. Working with HTTP
Overview
In this chapter, we will examine the fundamentals of HTTP and create a program that connects to a specific web server and downloads data. We will begin with a study of HTTP request methods so that you can begin to practice making requests using Java's HttpUrlConnection class on your own. You will then learn to retrieve data using the GET and HEAD requests, and to send JSON-formatted data using the POST request. Towards the end of this chapter, you will learn to extract and parse HTML content using the open-source jsoup library, and explore the java.net.http module—a new HTTP class provided by Java 11—which supports both synchronous and asynchronous HTTP requests.
Introduction
The Hypertext Transfer Protocol ...
Get The Java Workshop now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.