HttpClientTest.java Source code

Java tutorial

Introduction

Here is the source code for HttpClientTest.java

Source

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;

public class HttpClientTest {

    public static void main(String args[]) throws Exception {
        HttpClient client = new HttpClient();
        GetMethod method = new GetMethod("http://www.google.com");
        int returnCode = client.executeMethod(method);
        System.err.println(method.getResponseBodyAsString());
        method.releaseConnection();
    }
}