public class RequestExecutorImpl extends java.lang.Object implements RequestExecutor
RequestExecutor.ContentType, RequestExecutor.Method
Constructor and Description |
---|
RequestExecutorImpl(HttpClientProvider httpClientProvider,
URLHelper urlHelper) |
Modifier and Type | Method and Description |
---|---|
java.io.ByteArrayOutputStream |
executeRequest(java.lang.String urlString,
ParamsMap params,
ApiDefinition apiDefinition)
Gets the InputStream from the response and converts it into a ByteArrayOutputStream for laster use.
|
java.lang.String |
executeRequest(java.lang.String urlString,
ParamsMap params,
RequestExecutor.Method method)
Executes a request with given url, some params and a request method.
|
java.lang.String |
executeRequest(java.lang.String urlString,
ParamsMap params,
RequestExecutor.Method method,
RequestExecutor.ContentType contentTypeFormat)
Executes a request with given url and specifying the contentType, with some params and a request method.
|
java.lang.String |
executeRequest(java.lang.String urlString,
RequestExecutor.Method method)
Executes a request with given url and request method
|
java.lang.String |
executeRequest(java.lang.String urlString,
RequestExecutor.Method method,
RequestExecutor.ContentType contentTypeFormat)
Executes a request with given url and specifying the contentType, (without params) and a request method.
|
void |
setAuthorization(java.lang.String apiKey) |
void |
setAuthorization(java.lang.String username,
java.lang.String password)
Set the credentials required for the server authorization
|
@Inject public RequestExecutorImpl(HttpClientProvider httpClientProvider, URLHelper urlHelper)
public java.lang.String executeRequest(java.lang.String urlString, RequestExecutor.Method method) throws MambuApiException
RequestExecutor
executeRequest
in interface RequestExecutor
urlString
- the url to execute on. eg: https://demo.mambu.com/api/clientsMambuApiException
public java.lang.String executeRequest(java.lang.String urlString, ParamsMap params, RequestExecutor.Method method) throws MambuApiException
RequestExecutor
executeRequest
in interface RequestExecutor
urlString
- the url to execute on. eg: https://demo.mambu.com/api/clientsparams
- the parameters eg: {clientId=id}method
- the method (e.g. GET or PUT)MambuApiException
public java.lang.String executeRequest(java.lang.String urlString, RequestExecutor.Method method, RequestExecutor.ContentType contentTypeFormat) throws MambuApiException
RequestExecutor
executeRequest
in interface RequestExecutor
urlString
- the url to execute on. eg: https://demo.mambu.com/api/clientsmethod
- the method (e.g. GET or PUT)contentTypeFormat
- enum for the content type string (e.g WWW_FORM or JSON: will be using respectively the
"application/x-www-form-urlencoded; charset=UTF-8" or "application/json; charset=UTF-8";)MambuApiException
public java.lang.String executeRequest(java.lang.String urlString, ParamsMap params, RequestExecutor.Method method, RequestExecutor.ContentType contentTypeFormat) throws MambuApiException
RequestExecutor
executeRequest
in interface RequestExecutor
urlString
- the url to execute on. eg: https://demo.mambu.com/api/clientsparams
- the parameters eg: {clientId=id}, {JSON=jsonString}method
- the method (e.g. GET or PUT)contentTypeFormat
- enum for the content type string (e.g WWW_FORM or JSON: will be using respectively the
"application/x-www-form-urlencoded; charset=UTF-8" or "application/json; charset=UTF-8";)MambuApiException
public java.io.ByteArrayOutputStream executeRequest(java.lang.String urlString, ParamsMap params, ApiDefinition apiDefinition) throws MambuApiException
executeRequest
in interface RequestExecutor
urlString
- the url to execute on. eg: https://demo.mambu.com/api/database/backup/LATESTparams
- the parameters eg: {clientId=id}, {JSON=jsonString}apiDefinition
- the ApiDefinition holding details like HTTP method, content type and API return typeMambuApiException
public void setAuthorization(java.lang.String username, java.lang.String password)
RequestExecutor
setAuthorization
in interface RequestExecutor
public void setAuthorization(java.lang.String apiKey)
setAuthorization
in interface RequestExecutor