|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.geosolutions.geonetwork.util.HTTPUtils
public class HTTPUtils
Low level HTTP utilities.
Constructor Summary | |
---|---|
HTTPUtils()
|
|
HTTPUtils(String userName,
String password)
|
Method Summary | |
---|---|
boolean |
delete(String url)
|
boolean |
exists(String url)
Used to query for REST resources. |
String |
get(String url)
Performs an HTTP GET on the given URL. |
protected static String |
getGeoNetworkErrorMessage(InputStream msg)
|
protected static String |
getGeoNetworkErrorMessage(String msg)
|
int |
getLastHttpStatus()
|
boolean |
httpPing(String url)
|
boolean |
isIgnoreResponseContentOnSuccess()
|
String |
post(String url,
File file,
String contentType)
POSTs a File to the given URL. |
String |
post(String url,
InputStream content,
String contentType)
POSTs a Stream content to the given URL. |
String |
post(String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Performs a POST to the given URL. |
String |
post(String url,
String content,
String contentType)
POSTs a String to the given URL. |
String |
postXml(String url,
InputStream content)
POSTs a Stream content representing an XML document to the given URL. |
String |
postXml(String url,
String content)
POSTs a String representing an XML document to the given URL. |
String |
put(String url,
File file,
String contentType)
PUTs a File to the given URL. |
String |
put(String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Performs a PUT to the given URL. |
String |
put(String url,
String content,
String contentType)
PUTs a String to the given URL. |
String |
putXml(String url,
String content)
PUTs a String representing an XML document to the given URL. |
protected String |
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. |
void |
setIgnoreResponseContentOnSuccess(boolean ignoreResponseContentOnSuccess)
|
void |
setXmlContentType(String xmlContentType)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTTPUtils()
public HTTPUtils(String userName, String password)
Method Detail |
---|
public void setXmlContentType(String xmlContentType)
public int getLastHttpStatus()
public boolean isIgnoreResponseContentOnSuccess()
public void setIgnoreResponseContentOnSuccess(boolean ignoreResponseContentOnSuccess)
public String get(String url) throws MalformedURLException
url
- The URL where to connect to.
MalformedURLException
public String putXml(String url, String content)
url
- The URL where to connect to.content
- The XML content to be sent as a String.
MalformedURLException
public String 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.
MalformedURLException
public String 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.
MalformedURLException
public String put(String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity)
url
- The URL where to connect to.requestEntity
- The request to be sent.
MalformedURLException
public String postXml(String url, String content)
url
- The URL where to connect to.content
- The XML content to be sent as a String.
MalformedURLException
public String postXml(String url, InputStream content)
url
- The URL where to connect to.content
- The content to be sent as an InputStream.
MalformedURLException
public String 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.
MalformedURLException
public String 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.
MalformedURLException
public String 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.
MalformedURLException
public String post(String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity)
url
- The URL where to connect to.requestEntity
- The request to be sent.
MalformedURLException
protected String send(org.apache.commons.httpclient.methods.EntityEnclosingMethod httpMethod, String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity)
Only
public boolean delete(String url)
public boolean httpPing(String url)
public boolean exists(String url)
url
- The URL of the REST resource to query about.username
- pw
-
RuntimeException
- on unhandled status or exceptions.protected static String getGeoNetworkErrorMessage(String msg)
protected static String getGeoNetworkErrorMessage(InputStream msg)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |