public class HTTPUtils extends Object
| Constructor and Description |
|---|
HTTPUtils() |
| Modifier and Type | Method and Description |
|---|---|
static StringBuilder |
append(String... str) |
static StringBuilder |
append(URL base,
String... str)
Wrapper for
append(String...) |
static String |
decurtSlash(String geoserverURL) |
static boolean |
delete(String url,
String user,
String pw) |
static boolean |
exists(String url,
String username,
String pw)
Used to query for REST resources.
|
static String |
get(String url)
Performs an HTTP GET on the given URL.
|
static String |
get(String url,
String username,
String pw)
Performs an HTTP GET on the given URL.
|
static boolean |
httpPing(String url) |
static boolean |
httpPing(String url,
String username,
String pw) |
static String |
post(String url,
File file,
String contentType,
String username,
String pw)
POSTs a File to the given URL.
|
static String |
post(String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity,
String username,
String pw)
Performs a POST to the given URL.
|
static String |
post(String url,
String content,
String contentType,
String username,
String pw)
POSTs a String to the given URL.
|
static String |
postXml(String url,
String content,
String username,
String pw)
POSTs a String representing an XML document to the given URL.
|
static String |
put(String url,
File file,
String contentType,
String username,
String pw)
PUTs a File to the given URL.
|
static String |
put(String url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity,
String username,
String pw)
Performs a PUT to the given URL.
|
static String |
put(String url,
String content,
String contentType,
String username,
String pw)
PUTs a String to the given URL.
|
static String |
putXml(String url,
String content,
String username,
String pw)
PUTs a String representing an XML document to the given URL.
|
public static String get(String url) throws MalformedURLException
url - The URL where to connect to.MalformedURLExceptionpublic static String get(String url, String username, String pw)
url - The URL where to connect to.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String put(String url, File file, String contentType, String username, String pw)
url - The URL where to connect to.file - The File to be sent.contentType - The content-type to advert in the PUT.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String put(String url, String content, String contentType, String username, String pw)
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.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String putXml(String url, String content, String username, String pw)
url - The URL where to connect to.content - The XML content to be sent as a String.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String put(String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity, String username, String pw)
url - The URL where to connect to.requestEntity - The request to be sent.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String post(String url, File file, String contentType, String username, String pw)
url - The URL where to connect to.file - The File to be sent.contentType - The content-type to advert in the POST.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String post(String url, String content, String contentType, String username, String pw)
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.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String postXml(String url, String content, String username, String pw)
url - The URL where to connect to.content - The XML content to be sent as a String.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static String post(String url, org.apache.commons.httpclient.methods.RequestEntity requestEntity, String username, String pw)
url - The URL where to connect to.requestEntity - The request to be sent.username - Basic auth credential. No basic auth if null.pw - Basic auth credential. No basic auth if null.MalformedURLExceptionpublic static boolean httpPing(String url)
public static boolean exists(String url, String username, String pw)
url - The URL of the REST resource to query about.username - pw - RuntimeException - on unhandled status or exceptions.public static String decurtSlash(String geoserverURL)
geoserverURL - public static StringBuilder append(String... str)
str - a string arraypublic static StringBuilder append(URL base, String... str)
append(String...)base - base URLstr - strings to appendCopyright © 2007–2016 PDOK. All rights reserved.