public class BasicHttpClient
extends java.lang.Object
| Constructor and Description |
|---|
BasicHttpClient(java.lang.String baseUrl)
Creates an HTTP client for the specified base URL.
|
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(java.lang.String username,
java.lang.String password)
Sets the authentication credentials for authenticated requests
|
int |
executeMethod(org.apache.commons.httpclient.HttpMethodBase method)
Sends an HTTP request.
|
int |
executeMethod(org.apache.commons.httpclient.HttpMethodBase method,
boolean auth)
Sends an HTTP request
|
java.lang.String |
getBaseUrl()
Gets the base URL
|
org.apache.commons.httpclient.HttpClient |
getHttpClient(boolean auth)
Gets an HTTP client.
|
public BasicHttpClient(java.lang.String baseUrl)
baseUrl - the base URLpublic void authenticate(java.lang.String username,
java.lang.String password)
username - a usernamepassword - a passwordpublic org.apache.commons.httpclient.HttpClient getHttpClient(boolean auth)
auth - set true to use authentication, false to skip authenticationpublic java.lang.String getBaseUrl()
public int executeMethod(org.apache.commons.httpclient.HttpMethodBase method)
throws java.io.IOException
method - an HTTP methodjava.io.IOException - if an error occurred during the HTTP requestpublic int executeMethod(org.apache.commons.httpclient.HttpMethodBase method,
boolean auth)
throws java.io.IOException
method - an HTTP methodauth - true to request with authentication, false to request withoutjava.io.IOException - if an error occurred during the HTTP requestCopyright © 2009-2019. All Rights Reserved.