public class Client extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CONNECTION_TIMEOUT |
static int |
SO_TIMEOUT |
| Constructor and Description |
|---|
Client()
Creates a basic HTTP client.
|
Client(String user,
String password)
Creates a basic HTTP client capable of authenticating using Basic authentication.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getStringContent(String url,
int expectedStatusCode)
Retrieves the content available at
url as a String. |
public static final int CONNECTION_TIMEOUT
public static final int SO_TIMEOUT
public String getStringContent(String url, int expectedStatusCode)
url as a String. The server must respond with a status code equal to expectedStatusCode, otherwise this method will throw a ClientException;url - the URL from which to retrieve the contentexpectedStatusCode - the expected status code from the serverStringClientException - if the server's status code differs from the expectedStatusCode or if any other error is encounteredCopyright © 2020. All rights reserved.