public class HttpManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpManager.HttpMethod
This enumeration represents the HTTP methods supported by the server
|
| Modifier and Type | Method and Description |
|---|---|
static HttpManager |
getInstance() |
String |
getSessionId() |
URL |
getUrl() |
static HttpManager |
newInstance(URL url) |
HTTPResponse |
query(HttpManager.HttpMethod method,
String path)
Perform an http rest query to the server
|
HTTPResponse |
query(HttpManager.HttpMethod method,
String path,
com.google.gson.JsonElement body)
Perform an http rest query to the server with a body
|
HTTPResponse |
query(HttpManager.HttpMethod method,
String path,
com.google.gson.JsonElement body,
Map<String,String> headers)
Perform an http rest query to the server with a body and additionnal headers
|
void |
setSessionId(String sessionId) |
void |
setUrl(URL url) |
public static HttpManager newInstance(URL url)
public static HttpManager getInstance()
public final String getSessionId()
public final void setSessionId(String sessionId)
public final URL getUrl()
public final void setUrl(URL url)
url - the url to setpublic HTTPResponse query(HttpManager.HttpMethod method, String path, com.google.gson.JsonElement body) throws IOException, QueryException
path - a relative path to the api root path ((server)/api/v1/...)body - a body formated in json to be sent to the serverHTTPResponse the reponse from the serverIOException - if path is null or if an other I/O exception occurs.URISyntaxExceptionQueryExceptionpublic HTTPResponse query(HttpManager.HttpMethod method, String path) throws IOException, QueryException
path - a relative path to the api root path ((server)/api/v1/...)HTTPResponse the reponse from the serverIOException - if path is null or if an other I/O exception occurs.URISyntaxExceptionQueryExceptionpublic HTTPResponse query(HttpManager.HttpMethod method, String path, com.google.gson.JsonElement body, Map<String,String> headers) throws IOException, QueryException
path - a relative path to the api root path ((server)/api/v1/...)body - a body formated in json to be sent to the serverheaders - additional headersHTTPResponse the reponse from the serverIOException - if path is null or if an other I/O exception occurs.QueryException - various query exceptions depending on the response from the serverURISyntaxExceptionCopyright © 2019 Nowtryz. All rights reserved.