- java.lang.Object
-
- aeonics.util.Http
-
public class Http extends java.lang.Object
Simple http request fetcher. The result is returned as data. If the response mime type wasapplication/json
, then it is automatically decoded.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Http.Error
Represents an HTTP Error code with possibly a body response.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Data
get(java.lang.String url)
Fetches the specified resource using GETstatic Data
get(java.lang.String url, Data queryString)
Fetches the specified resource using GETstatic Data
get(java.lang.String url, Data queryString, Data headers)
Fetches the specified resource using GETstatic Data
get(java.lang.String url, Data queryString, Data headers, java.lang.String method)
Fetches the specified resource using the provided methodstatic Data
post(java.lang.String url)
Fetches the specified resource using POSTstatic Data
post(java.lang.String url, Data body)
Fetches the specified resource using POSTstatic Data
post(java.lang.String url, Data body, Data headers)
Fetches the specified resource using POSTstatic Data
post(java.lang.String url, Data body, Data headers, java.lang.String method)
Fetches the specified resource using the provided method
-
-
-
Method Detail
-
post
public static Data post(java.lang.String url)
Fetches the specified resource using POST- Parameters:
url
- the url- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
post
public static Data post(java.lang.String url, Data body)
Fetches the specified resource using POST- Parameters:
url
- the urlbody
- the content to send in key/value pairs- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
post
public static Data post(java.lang.String url, Data body, Data headers)
Fetches the specified resource using POST- Parameters:
url
- the urlbody
- the content to send in key/value pairsheaders
- the http request headers- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
post
public static Data post(java.lang.String url, Data body, Data headers, java.lang.String method)
Fetches the specified resource using the provided method- Parameters:
url
- the urlbody
- the content to send in key/value pairsheaders
- the http request headersmethod
- the http method- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
get
public static Data get(java.lang.String url)
Fetches the specified resource using GET- Parameters:
url
- the url- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
get
public static Data get(java.lang.String url, Data queryString)
Fetches the specified resource using GET- Parameters:
url
- the urlqueryString
- the content to append to the url in key/value pairs- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
get
public static Data get(java.lang.String url, Data queryString, Data headers)
Fetches the specified resource using GET- Parameters:
url
- the urlqueryString
- the content to append to the url in key/value pairsheaders
- the http request headers- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
get
public static Data get(java.lang.String url, Data queryString, Data headers, java.lang.String method)
Fetches the specified resource using the provided method- Parameters:
url
- the urlqueryString
- the content to append to the url in key/value pairsheaders
- the http request headersmethod
- the http method- Returns:
- the response
- Throws:
Http.Error
- if the remote endpoint returns an error (http code 400+)
-
-