The standard Java virtual machine provides HTTP connectivity with these classes in java.net package:
URL allows you to use Uniform Resource Locator strings for HTTP connections and other protocol connections that can be represented by URLs.
URLConnection represents a connection to a server and resource indicated by a URL.
HttpURLConnection extends URL with additional methods that are specific to the HTTP protocol.
For details on these classes, see the JDK documentation. The following code shows a typical example. This code opens a connection, retrieves the data (text is assumed), and prints it:
URL url = new URL("http://www.sybase.com/");
URLConnection conn = url.openConnection();
conn.connect();
InputStreamReader content
= new InputStreamReader(conn.getInputStream());
for (int i=0; i != -1; i = content.read())
{
System.out.print((char) i);
}