public class SimpleHttpClient extends Object implements HttpClient
Constructor and Description |
---|
SimpleHttpClient()
Creates an instance with
timeout = ms. |
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 |
executeGet(String baseUri,
RequestParameters parameters) |
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)
Sends the given payload as content-type text/xml with UTF-8 encoding to the determined URI.
|
org.apache.http.conn.ClientConnectionManager |
getConnectionManager() |
org.apache.http.impl.client.DefaultHttpClient |
getHttpClientToDecorate() |
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 timout in milliseconds.public org.apache.http.conn.ClientConnectionManager getConnectionManager()
public org.apache.http.impl.client.DefaultHttpClient getHttpClientToDecorate()
getHttpClientToDecorate
in interface HttpClient
public org.apache.http.HttpResponse executeGet(String uri) throws HttpClientException
executeGet
in interface HttpClient
HttpClientException
public org.apache.http.HttpResponse executeGet(String baseUri, RequestParameters parameters) throws HttpClientException
executeGet
in interface HttpClient
baseUri
- the target to send the GET request to.parameters
- the request/query parameters.HttpClientException
- if sending the request fails.public org.apache.http.HttpResponse executePost(String uri, org.apache.xmlbeans.XmlObject payloadToSend) throws HttpClientException
HttpClient
HttpClient.executePost(String, String, ContentType)
instead.executePost
in interface HttpClient
uri
- the target to send the POST request to.payloadToSend
- the POST payload as XML encoded as UTF-8.HttpClientException
- if sending the request fails.public org.apache.http.HttpResponse executePost(String uri, String payloadToSend) throws HttpClientException
HttpClient
HttpClient.executePost(String, String, ContentType)
instead.executePost
in interface HttpClient
uri
- the target to send the POST request to.payloadToSend
- the POST payload as XML encoded as UTF-8.HttpClientException
- if sending the request fails.public org.apache.http.HttpResponse executePost(String uri, String payloadToSend, org.apache.http.entity.ContentType contentType) throws HttpClientException
HttpClient
executePost
in interface HttpClient
uri
- the target to send the POST request to.payloadToSend
- the POST payload as XML.contentType
- the content-type of the payload.HttpClientException
- if sending the request fails.public org.apache.http.HttpResponse executePost(String uri, org.apache.http.HttpEntity payloadToSend) throws HttpClientException
HttpClient
executePost
in interface HttpClient
uri
- the target to send the POST request to.payloadToSend
- a more generic way to send arbitrary content.HttpClientException
- if sending the request fails.public org.apache.http.HttpResponse executeMethod(org.apache.http.client.methods.HttpRequestBase method) throws HttpClientException
executeMethod
in interface HttpClient
method
- the HTTP method to execute.HttpClientException
- if sending the request failspublic void setConnectionTimout(int timeout)
public void setSocketTimout(int timeout)
Copyright © 2012–2017 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.