Package org.forgerock.util
Class SimpleHTTPClient
java.lang.Object
org.forgerock.util.SimpleHTTPClient
Simple helper client for connecting to URLs over HTTP
and retrieving their contents via a GET request.
Settable timeouts on read and connection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault connection timeout on HTTP requests from this client.static final intDefault read timeout on HTTP requests from this client. -
Constructor Summary
ConstructorsConstructorDescriptionGenerates a new SimpleHTTPClient with the appropriate timeouts.SimpleHTTPClient(int readTimeout, int connTimeout) Generates a new SimpleHTTPClient with the appropriate timeouts. -
Method Summary
-
Field Details
-
DEFAULT_READ_TIMEOUT
Default read timeout on HTTP requests from this client.- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
Default connection timeout on HTTP requests from this client.- See Also:
-
-
Constructor Details
-
SimpleHTTPClient
public SimpleHTTPClient()Generates a new SimpleHTTPClient with the appropriate timeouts. -
SimpleHTTPClient
Generates a new SimpleHTTPClient with the appropriate timeouts.- Parameters:
readTimeout- read timeout value (greater than or equal to zero)connTimeout- connection timeout value (greater than or equal to zero)
-
-
Method Details
-
get
Utility method for gathering the contents of an HTTP page. Should ideally be in an HTTP Client utils type package, rather than here.- Parameters:
url- from which to attempt to retrieve the contents- Returns:
- The contents of the provided url
- Throws:
IOException- If there are any problems connecting to or gathering the contents of the page
-