public class SimpleHttpClient extends Object implements HttpClient
| Modifier | Constructor and Description |
|---|---|
|
SimpleHttpClient()
Creates an instance with
timeout = ms. |
protected |
SimpleHttpClient(org.apache.http.impl.client.CloseableHttpClient httpclient) |
|
SimpleHttpClient(int connectionTimeout)
Creates an instance with a given connection timeout.
|
|
SimpleHttpClient(int connectionTimeout,
int socketTimeout)
Creates an instance with the given timeouts.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.http.HttpResponse |
executeGet(String uri) |
org.apache.http.HttpResponse |
executeMethod(org.apache.http.client.methods.HttpRequestBase method) |
org.apache.http.HttpResponse |
executePost(String uri,
org.apache.http.HttpEntity payloadToSend)
Sends the given payload to the determined URI.
|
org.apache.http.HttpResponse |
executePost(String uri,
String payloadToSend)
Sends the given payload as content-type text/xml with UTF-8 encoding to the determined URI.
|
org.apache.http.HttpResponse |
executePost(String uri,
String payloadToSend,
org.apache.http.entity.ContentType contentType)
Sends the given payload (marked to be of a specific content-type) to the determined URI.
|
org.apache.http.HttpResponse |
executePost(String uri,
org.apache.xmlbeans.XmlObject payloadToSend) |
void |
setConnectionTimout(int timeout) |
void |
setSocketTimout(int timeout) |
public SimpleHttpClient()
timeout = ms.public SimpleHttpClient(int connectionTimeout)
connectionTimeout - the connection timeout in milliseconds.public SimpleHttpClient(int connectionTimeout,
int socketTimeout)
connectionTimeout - the connection timeout in milliseconds.socketTimeout - the socket timeout in milliseconds.protected SimpleHttpClient(org.apache.http.impl.client.CloseableHttpClient httpclient)
public org.apache.http.HttpResponse executeGet(String uri) throws IOException
executeGet in interface HttpClientIOExceptionpublic org.apache.http.HttpResponse executePost(String uri, org.apache.xmlbeans.XmlObject payloadToSend) throws IOException
IOExceptionpublic org.apache.http.HttpResponse executePost(String uri, String payloadToSend) throws IOException
HttpClientHttpClient.executePost(String, String, ContentType) instead.executePost in interface HttpClienturi - the target to send the POST request to.payloadToSend - the POST payload as XML encoded as UTF-8.IOException - if sending the request fails.public org.apache.http.HttpResponse executePost(String uri, String payloadToSend, org.apache.http.entity.ContentType contentType) throws IOException
HttpClientexecutePost in interface HttpClienturi - the target to send the POST request to.payloadToSend - the POST payload as XML.contentType - the content-type of the payload.IOException - if sending the request fails.public org.apache.http.HttpResponse executePost(String uri, org.apache.http.HttpEntity payloadToSend) throws IOException
HttpClientexecutePost in interface HttpClienturi - the target to send the POST request to.payloadToSend - a more generic way to send arbitrary content.IOException - if sending the request fails.public org.apache.http.HttpResponse executeMethod(org.apache.http.client.methods.HttpRequestBase method)
throws IOException
executeMethod in interface HttpClientmethod - the HTTP method to execute.IOException - if sending the request failspublic void setConnectionTimout(int timeout)
public void setSocketTimout(int timeout)
Copyright © 2015–2018 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.