|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.util.HttpClientUtils
public class HttpClientUtils
Utility class for the jakarta common HttpClient
Field Summary | |
---|---|
static String |
REVISION
|
Constructor Summary | |
---|---|
HttpClientUtils()
|
Method Summary | |
---|---|
static String |
getContent(String url)
Retrieves the content of the specified url as a string. |
static void |
getContent(String url,
File file)
Save the content of the specified url in the given file. |
static void |
getContent(String url,
File file,
int timeout)
Save the content of the specified url in the given file. |
static void |
getContent(String url,
File file,
int timeout,
String userAgent)
Save the content of the specified url in the given file. |
static String |
getContent(String url,
int timeout,
String userAgent)
Retrieves the content of the specified url. |
static String |
getContent(String url,
String userAgent)
Retrieves the content of the specified url. |
static org.apache.commons.httpclient.HttpClient |
getNewHttpClient(String url,
int timeout)
Retrieve a new configured HttpClient instance. |
static String |
postAndGetContent(String url,
int timeout,
String userAgent,
org.apache.commons.httpclient.NameValuePair[] data)
Post the specified data to the specified url and retrieve the content as a string. |
static String |
postAndGetContent(String url,
int timeout,
String userAgent,
org.apache.commons.httpclient.NameValuePair[] data,
String charset)
Post the specified data to the specified url and retrieve the content as a string. |
static void |
setProxyParams(org.apache.commons.httpclient.HttpClient client,
String remoteHostName)
Set HttpClient proxy parameters based on Java Properties. |
static void |
setProxyParamsForUrl(org.apache.commons.httpclient.HttpClient client,
String remoteUrl)
Set HttpClient proxy parameters based on Java Properties. |
static void |
setProxyParamsForUrl(org.apache.commons.httpclient.HttpClient client,
URL remoteURL)
Set HttpClient proxy parameters based on Java Properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public HttpClientUtils()
Method Detail |
---|
public static org.apache.commons.httpclient.HttpClient getNewHttpClient(String url, int timeout) throws MalformedURLException
url
- the url that will be accessed with this clienttimeout
- the timeout value to use
MalformedURLException
public static void setProxyParams(org.apache.commons.httpclient.HttpClient client, String remoteHostName)
client
- the HttpClient instance of which proxy parametersremoteHostName
- the remote URL for which the HttpClient is being used
it is required in order to be able to apply the rules specified
in the system property "http.nonProxyHosts"public static void setProxyParamsForUrl(org.apache.commons.httpclient.HttpClient client, String remoteUrl) throws MalformedURLException
client
- the HttpClient instance of which proxy parametersremoteUrl
- the remote url for which the HttpClient is being used.
It is required in order to be able to apply the rules specified
in the system property "http.nonProxyHosts"
MalformedURLException
public static void setProxyParamsForUrl(org.apache.commons.httpclient.HttpClient client, URL remoteURL)
client
- the HttpClient instance of which proxy parametersremoteURL
- the remote URL for which the HttpClient is being used.
It is required in order to be able to apply the rules specified
in the system property "http.nonProxyHosts"public static String getContent(String url) throws org.apache.commons.httpclient.HttpException, IOException
Warning: The size of the response body is not controlled and may consume a lot of memory.
url
- the url to access
org.apache.commons.httpclient.HttpException
IOException
public static String getContent(String url, String userAgent) throws org.apache.commons.httpclient.HttpException, IOException
Warning: The size of the response body is not controlled and may consume a lot of memory.
url
- the url to accessuserAgent
- the User-Agent
org.apache.commons.httpclient.HttpException
IOException
public static String getContent(String url, int timeout, String userAgent) throws org.apache.commons.httpclient.HttpException, IOException
Warning: The size of the response body is not controlled and may consume a lot of memory.
url
- the url to accesstimeout
- the time (in milliseconds) to wait for a connection to become available.
Default value is 3000 (3 seconds).
Default value will be used if zero or a negative value is specified.userAgent
- the User-Agent
org.apache.commons.httpclient.HttpException
IOException
public static void getContent(String url, File file) throws org.apache.commons.httpclient.HttpException, IOException
url
- the url to accessfile
- the output file
org.apache.commons.httpclient.HttpException
IOException
public static void getContent(String url, File file, int timeout) throws org.apache.commons.httpclient.HttpException, IOException
url
- the url to accessfile
- the output filetimeout
- the time (in milliseconds) to wait for a connection to become available.
Default value is 3000 (3 seconds).
Default value will be used if zero or a negative value is specified.
org.apache.commons.httpclient.HttpException
IOException
public static void getContent(String url, File file, int timeout, String userAgent) throws org.apache.commons.httpclient.HttpException, IOException
url
- the url to accessuserAgent
- the User-Agentfile
- the output filetimeout
- the connection timeout
org.apache.commons.httpclient.HttpException
IOException
public static String postAndGetContent(String url, int timeout, String userAgent, org.apache.commons.httpclient.NameValuePair[] data) throws org.apache.commons.httpclient.HttpException, IOException
Warning: The size of the response body is not controlled and may consume a lot of memory. Charset encoding used is the default one in HTTP : ISO-8859-1
url
- the url to accesstimeout
- the time (in milliseconds) to wait for a connection to become available.
Default value is 3000 (3 seconds).
Default value will be used if zero or a negative value is specified.userAgent
- the User-Agentdata
- the parameters to be posted to the remote url
org.apache.commons.httpclient.HttpException
IOException
public static String postAndGetContent(String url, int timeout, String userAgent, org.apache.commons.httpclient.NameValuePair[] data, String charset) throws org.apache.commons.httpclient.HttpException, IOException
Warning: The size of the response body is not controlled and may consume a lot of memory.
url
- the url to accesstimeout
- the time (in milliseconds) to wait for a connection to become available.
Default value is 3000 (3 seconds).
Default value will be used if zero or a negative value is specified.userAgent
- the User-Agentdata
- the parameters to be posted to the remote urlcharset
- the charset encoding to use. If null, uses the default one in HTTP : ISO-8859-1
org.apache.commons.httpclient.HttpException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |