Package com.moesif.api.http.client
Interface HttpClient
-
- All Known Implementing Classes:
UnirestClient
public interface HttpClient
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpRequestdelete(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)Create an HTTP DELETE request with parametersHttpRequestdelete(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)Create an HTTP DELETE request with parameters and with basic authenticationHttpBodyRequestdeleteBody(String _queryUrl, Map<String,String> _headers, String _body)Create an HTTP DELETE request with bodyHttpBodyRequestdeleteBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)Create an HTTP DELETE request with body and with basic authenticationHttpResponseexecuteAsBinary(HttpRequest request)Execute a given HttpRequest to get binary response backvoidexecuteAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack)Execute a given HttpRequest to get binary response backvoidexecuteAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack, boolean debug)HttpResponseexecuteAsString(HttpRequest request)Execute a given HttpRequest to get string response backvoidexecuteAsStringAsync(HttpRequest request, APICallBack<HttpResponse> callBack)Execute a given HttpRequest to get string response backHttpRequestget(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)Create a simple HTTP GET requestHttpRequestget(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)Create a simple HTTP GET request with basic authenticationHttpRequestpatch(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)Create an HTTP PATCH request with parametersHttpRequestpatch(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)Create an HTTP PATCH request with parameters and with basic authenticationHttpBodyRequestpatchBody(String _queryUrl, Map<String,String> _headers, String _body)Create an HTTP PATCH request with bodyHttpBodyRequestpatchBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)Create an HTTP PATCH request with body and with basic authenticationHttpRequestpost(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)Create an HTTP POST request with parametersHttpRequestpost(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)Create an HTTP POST request with parameters and with basic authenticationHttpBodyRequestpostBody(String _queryUrl, Map<String,String> _headers, String _body)Create an HTTP POST request with bodyHttpBodyRequestpostBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)Create an HTTP POST request with body and with basic authenticationHttpRequestput(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)Create an HTTP PUT request with parametersHttpRequestput(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)Create an HTTP PUT request with parameters and with basic authenticationHttpBodyRequestputBody(String _queryUrl, Map<String,String> _headers, String _body)Create an HTTP PUT request with bodyHttpBodyRequestputBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)Create an HTTP PUT request with body and with basic authentication
-
-
-
Method Detail
-
executeAsStringAsync
void executeAsStringAsync(HttpRequest request, APICallBack<HttpResponse> callBack)
Execute a given HttpRequest to get string response back- Parameters:
request- The given HttpRequest to executecallBack- Callback after execution
-
executeAsBinaryAsync
void executeAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack)
Execute a given HttpRequest to get binary response back- Parameters:
request- The given HttpRequest to executecallBack- Callback after execution
-
executeAsBinaryAsync
void executeAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack, boolean debug) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
executeAsBinary
HttpResponse executeAsBinary(HttpRequest request) throws APIException
Execute a given HttpRequest to get binary response back- Parameters:
request- The given HttpRequest to execute- Returns:
- the HTTP response
- Throws:
APIException- on error executing request
-
executeAsString
HttpResponse executeAsString(HttpRequest request) throws APIException
Execute a given HttpRequest to get string response back- Parameters:
request- The given HttpRequest to execute- Returns:
- the HTTP response
- Throws:
APIException- on error executing request
-
get
HttpRequest get(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)
Create a simple HTTP GET request with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
get
HttpRequest get(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)
Create a simple HTTP GET request- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params- Returns:
- the request object
-
post
HttpRequest post(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)
Create an HTTP POST request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params- Returns:
- the request object
-
post
HttpRequest post(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)
Create an HTTP POST request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
postBody
HttpBodyRequest postBody(String _queryUrl, Map<String,String> _headers, String _body)
Create an HTTP POST request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
postBody
HttpBodyRequest postBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)
Create an HTTP POST request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
put
HttpRequest put(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)
Create an HTTP PUT request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters- Returns:
- the request object
-
put
HttpRequest put(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)
Create an HTTP PUT request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
putBody
HttpBodyRequest putBody(String _queryUrl, Map<String,String> _headers, String _body)
Create an HTTP PUT request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
putBody
HttpBodyRequest putBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)
Create an HTTP PUT request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
patch
HttpRequest patch(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)
Create an HTTP PATCH request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters- Returns:
- the request object
-
patch
HttpRequest patch(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)
Create an HTTP PATCH request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
patchBody
HttpBodyRequest patchBody(String _queryUrl, Map<String,String> _headers, String _body)
Create an HTTP PATCH request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
patchBody
HttpBodyRequest patchBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)
Create an HTTP PATCH request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
delete
HttpRequest delete(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters)
Create an HTTP DELETE request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters- Returns:
- the request object
-
delete
HttpRequest delete(String _queryUrl, Map<String,String> _headers, Map<String,Object> _parameters, String _username, String _password)
Create an HTTP DELETE request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
deleteBody
HttpBodyRequest deleteBody(String _queryUrl, Map<String,String> _headers, String _body)
Create an HTTP DELETE request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
deleteBody
HttpBodyRequest deleteBody(String _queryUrl, Map<String,String> _headers, String _body, String _username, String _password)
Create an HTTP DELETE request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
-