public class BasicHttpClient extends Object
| Constructor and Description |
|---|
BasicHttpClient(String baseUrl)
Creates an HTTP client for the specified base URL.
|
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(String username,
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
|
String |
getBaseUrl()
Gets the base URL
|
org.apache.commons.httpclient.HttpClient |
getHttpClient(boolean auth)
Gets an HTTP client.
|
public BasicHttpClient(String baseUrl)
baseUrl - the base URLpublic void authenticate(String username, 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 String getBaseUrl()
public int executeMethod(org.apache.commons.httpclient.HttpMethodBase method)
throws IOException
method - an HTTP methodIOException - if an error occurred during the HTTP requestpublic int executeMethod(org.apache.commons.httpclient.HttpMethodBase method,
boolean auth)
throws IOException
method - an HTTP methodauth - true to request with authentication, false to request withoutIOException - if an error occurred during the HTTP requestCopyright © 2009-2013. All Rights Reserved.