O'Reilly logo

Java™ Network Programming and Distributed Computing by Michael Reilly, David Reilly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.2. HTTP and Java

Java provides extremely good support for the HyperText Transfer Protocol. While developers are free to write their own HTTP implementations using TCP sockets, the java.net package provides several classes that offer HTTP functionality:

  • java.net.URL

  • java.net.URLConnection

  • java.net.HttpURLConnection

9.2.1. URL Class

The URL class represents one of the most frequently used address types of the Internet, the Uniform Resource Locator (URL). URLs can point to files, Web sites, ftp sites, newsgroups, e-mail addresses, and other resources. Some fictitious examples of non-Web URLs are:

  • ftp://records.area51.mil/roswell/subjects/autopsy/

  • telnet://localhost:8000/

  • mailto:president@whitehouse.gov?subject=My%20Opinion

In the context of HTTP and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required