Package our.apache.commons.httpclient

Examples of our.apache.commons.httpclient.HttpClient


     * @throws IOException If there is a problem in making the request.
     */
    public int executeRequest(HttpMethod method,
                              String fullURL) throws IOException {
        // Create a client for the connection
        HttpClient client = new HttpClient();

        // Timeout connections after 15 seconds
        client.setConnectionTimeout(15000);

        // Timeout connected sockets after 30 seconds
        client.setTimeout(30000);

        // Execute the method.
        int statusCode = -1;
        int attempt = 0;

        // Retry the request up to 3 times
        while ((statusCode == -1) && (attempt < 3)) {
            statusCode = client.executeMethod(method);
            attempt++;
        }

        // If the status code is still -1 then ran out of retries to
        // connect to the server
View Full Code Here

TOP

Related Classes of our.apache.commons.httpclient.HttpClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.