public class HTTPCallsUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
HTTPCallsUtils.HttpResponse
The Class HttpResponse.
|
| Constructor and Description |
|---|
HTTPCallsUtils()
Instantiates a new HTTP utils.
|
HTTPCallsUtils(String userName,
String password)
Instantiates a new HTTP utils.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete(String url)
Delete.
|
boolean |
exists(String url)
Used to query for REST resources.
|
HTTPCallsUtils.HttpResponse |
get(String url)
Performs an HTTP GET on the given URL.
|
org.apache.commons.httpclient.HttpClient |
getClient()
Gets the client.
|
protected static String |
getGeoNetworkErrorMessage(InputStream msg)
Gets the geo network error message.
|
protected static String |
getGeoNetworkErrorMessage(String msg)
Gets the geo network error message.
|
String |
getLastContentType()
Gets the last content type.
|
int |
getLastHttpStatus()
Gets the last http status.
|
boolean |
httpPing(String url)
Http ping.
|
boolean |
isIgnoreResponseContentOnSuccess()
Checks if is ignore response content on success.
|
InputStream |
post(String url,
File file,
String contentType)
POSTs a File to the given URL.
|
InputStream |
post(String url,
InputStream content,
String contentType)
POSTs a Stream content to the given URL.
|
InputStream |
post(String url,
InputStream content,
String contentType,
Map<String,String[]> parameterMap)
POSTs a Stream content to the given URL.
|
InputStream |
post(String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity,
Map<String,String[]> parameterMap)
Performs a POST to the given URL.
|
InputStream |
post(String url,
String content,
String contentType)
POSTs a String to the given URL.
|
InputStream |
postXml(String url,
InputStream content)
POSTs a Stream content representing an XML document to the given URL.
|
InputStream |
postXml(String url,
String content)
POSTs a String representing an XML document to the given URL.
|
InputStream |
put(String url,
File file,
String contentType)
PUTs a File to the given URL.
|
InputStream |
put(String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Performs a PUT to the given URL.
|
InputStream |
put(String url,
String content,
String contentType)
PUTs a String to the given URL.
|
InputStream |
putXml(String url,
String content)
PUTs a String representing an XML document to the given URL.
|
protected InputStream |
send(org.apache.commons.httpclient.methods.EntityEnclosingMethod httpMethod,
String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Send an HTTP request (PUT or POST) to a server.
|
protected InputStream |
sendPost(org.apache.commons.httpclient.methods.EntityEnclosingMethod httpMethod,
String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Send an HTTP request (PUT or POST) to a server.
|
void |
setIgnoreResponseContentOnSuccess(boolean ignoreResponseContentOnSuccess)
Sets the ignore response content on success.
|
void |
setXmlContentType(String xmlContentType)
Sets the xml content type.
|
public void setXmlContentType(String xmlContentType)
xmlContentType - the new xml content typepublic int getLastHttpStatus()
public boolean isIgnoreResponseContentOnSuccess()
public void setIgnoreResponseContentOnSuccess(boolean ignoreResponseContentOnSuccess)
ignoreResponseContentOnSuccess - the new ignore response content on successpublic HTTPCallsUtils.HttpResponse get(String url) throws MalformedURLException
url - The URL where to connect to.MalformedURLException - the malformed url exceptionpublic String getLastContentType()
public org.apache.commons.httpclient.HttpClient getClient()
public InputStream putXml(String url, String content)
url - The URL where to connect to.content - The XML content to be sent as a String.public InputStream put(String url, File file, String contentType)
url - The URL where to connect to.file - The File to be sent.contentType - The content-type to advert in the PUT.public InputStream put(String url, String content, String contentType)
url - The URL where to connect to.content - The content to be sent as a String.contentType - The content-type to advert in the PUT.public InputStream put(String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity)
url - The URL where to connect to.requestEntity - The request to be sent.public InputStream postXml(String url, String content)
url - The URL where to connect to.content - The XML content to be sent as a String.public InputStream postXml(String url, InputStream content)
url - The URL where to connect to.content - The content to be sent as an InputStream.public InputStream post(String url, File file, String contentType)
url - The URL where to connect to.file - The File to be sent.contentType - The content-type to advert in the POST.public InputStream post(String url, String content, String contentType)
url - The URL where to connect to.content - The content to be sent as a String.contentType - The content-type to advert in the POST.public InputStream post(String url, InputStream content, String contentType)
url - The URL where to connect to.content - The content to be sent as an InputStream.contentType - The content-type to advert in the POST.public InputStream post(String url, InputStream content, String contentType, Map<String,String[]> parameterMap)
url - the urlcontent - The content to be sent as an InputStream.contentType - The content-type to advert in the POST.parameterMap - the parameter mappublic InputStream post(String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity, Map<String,String[]> parameterMap)
url - The URL where to connect to.requestEntity - The request to be sent.parameterMap - the parameter mapprotected InputStream send(org.apache.commons.httpclient.methods.EntityEnclosingMethod httpMethod, String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Only
httpMethod - the http methodurl - the urlrequestEntity - the request entityprotected InputStream sendPost(org.apache.commons.httpclient.methods.EntityEnclosingMethod httpMethod, String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Only
httpMethod - the http methodurl - the urlrequestEntity - the request entitypublic boolean delete(String url)
url - the urlpublic boolean httpPing(String url)
url - the urlpublic boolean exists(String url)
url - The URL of the REST resource to query about.protected static String getGeoNetworkErrorMessage(String msg)
msg - the msgprotected static String getGeoNetworkErrorMessage(InputStream msg)
msg - the msgCopyright © 2022. All Rights Reserved.