Skip to Content
The Java Workshop
book

The Java Workshop

by David Cuartielles, Pradeep Kumar Gupta, Scott Cosentino, Andreas Göransson, Eric Foster-Johnson, Avinash Kate
October 2019
Beginner
606 pages
10h 37m
English
Packt Publishing
Content preview from The Java Workshop

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern Java Collections

Modern Java Collections

Simon Roberts
Java By Comparison

Java By Comparison

Simon Harrer, Linus Dietz, Jörg Lenhard

Publisher Resources

ISBN: 9781838986698Supplemental Content