Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Java Networking - Tutorial

Lars Vogel

Version 0.8

05.01.2011

Revision History
Revision 0.103.10.2008Lars Vogel
First Version
Revision 0.2 - 0.801.05.2009 - 05.01.2011Lars Vogel
bug fixes and enhancements

Java Networking

This article describes how to use java.net to access the internet. The setting of a proxy is also described.


Table of Contents

1. HTML Webpages and Java
2. Examples
2.1. Read web page via Java
2.2. Getting the return code from a webpage
2.3. Content Type / MIME Type
3. Using Http get services
4. Proxy
5. Thank you
6. Questions and Discussion
7. Resources

1. HTML Webpages and Java

Java provides API's to access resources over the network, for example to read webpages. The main classes which are used to read web resources is "java.net.URL" and "java.net.HttpURLConnection". URL can be used to define a web resources while "HttpURLConnection" can be used to access the web resource.

The Apache Foundation provides a powerful framework to to transmit and receive HTTP messages via the Apache HttpClient .