|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.almende.util.HttpUtil
public class HttpUtil
Constructor Summary | |
---|---|
HttpUtil()
|
Method Summary | |
---|---|
static String |
appendQueryParams(String url,
Map<String,String> params)
Append query parameters to given url |
static String |
delete(String url)
Send a delete request |
static String |
delete(String url,
Map<String,String> headers)
Send a delete request |
static String |
fetch(String method,
String url,
String body,
Map<String,String> headers)
Send a request |
static String |
get(String url)
Send a get request |
static String |
get(String url,
Map<String,String> headers)
Send a get request |
static Map<String,String> |
getQueryParams(String url)
Retrieve the query parameters from given url |
static Map<String,String> |
getTemplateParams(String template,
String url)
Retrieve the template parameters from an url. |
static String |
post(String url,
String body)
Send a post request |
static String |
post(String url,
String body,
Map<String,String> headers)
Send a post request |
static String |
postForm(String url,
Map<String,String> params)
Post a form with parameters |
static String |
postForm(String url,
Map<String,String> params,
Map<String,String> headers)
Post a form with parameters |
static String |
put(String url,
String body)
Send a put request |
static String |
put(String url,
String body,
Map<String,String> headers)
Send a put request |
static String |
removeQueryParams(String url)
Returns the url without query parameters |
static String |
setTemplateParams(String template,
Map<String,String> params)
Create an url from a template and a map with parameter values. |
static String |
streamToString(InputStream in)
Read an input stream into a string |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpUtil()
Method Detail |
---|
public static String get(String url) throws IOException
url
-
IOException
public static String get(String url, Map<String,String> headers) throws IOException
url
- Url as stringheaders
- Optional map with headers
IOException
public static String post(String url, String body, Map<String,String> headers) throws IOException
url
- Url as stringbody
- Request body as stringheaders
- Optional map with headers
IOException
public static String post(String url, String body) throws IOException
url
- Url as stringbody
- Request body as string
IOException
public static String postForm(String url, Map<String,String> params) throws IOException
url
- Url as stringparams
- map with parameters/values
IOException
public static String postForm(String url, Map<String,String> params, Map<String,String> headers) throws IOException
url
- Url as stringparams
- Map with parameters/valuesheaders
- Optional map with headers
IOException
public static String put(String url, String body, Map<String,String> headers) throws IOException
url
- Url as stringbody
- Request body as stringheaders
- Optional map with headers
IOException
public static String put(String url, String body) throws IOException
url
- Url as string
IOException
public static String delete(String url, Map<String,String> headers) throws IOException
url
- Url as stringheaders
- Optional map with headers
IOException
public static String delete(String url) throws IOException
url
- Url as string
IOException
public static String appendQueryParams(String url, Map<String,String> params) throws IOException
url
- Url as stringparams
- Map with query parameters
IOException
public static Map<String,String> getQueryParams(String url) throws IOException
url
- Url containing query parameters
IOException
public static Map<String,String> getTemplateParams(String template, String url)
template
- A template urlurl
- A url with parameters
public static String setTemplateParams(String template, Map<String,String> params)
template
- A template urlurl
- A url with parameters
public static String removeQueryParams(String url) throws IOException
url
- Url containing query parameters
IOException
public static String fetch(String method, String url, String body, Map<String,String> headers) throws IOException
method
- HTTP method, for example "GET" or "POST"url
- Url as stringbody
- Request body as stringheaders
- Optional map with headers
IOException
public static String streamToString(InputStream in) throws IOException
in
-
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |