public class CoreHttpProvider extends java.lang.Object implements IHttpProvider
| Constructor and Description |
|---|
CoreHttpProvider(ISerializer serializer,
IAuthenticationProvider authenticationProvider,
IExecutors executors,
ILogger logger)
Creates the DefaultHttpProvider
|
| Modifier and Type | Method and Description |
|---|---|
IAuthenticationProvider |
getAuthenticationProvider() |
IConnectionConfig |
getConnectionConfig()
Get connection config for read and connect timeout in requests
|
IExecutors |
getExecutors() |
ILogger |
getLogger() |
ISerializer |
getSerializer()
Gets the serializer for this HTTP provider
|
<Result,Body> |
send(IHttpRequest request,
java.lang.Class<Result> resultClass,
Body serializable)
Sends the HTTP request
|
<Result,Body,DeserializeType> |
send(IHttpRequest request,
java.lang.Class<Result> resultClass,
Body serializable,
IStatefulResponseHandler<Result,DeserializeType> handler)
Sends the HTTP request
|
<Result,Body> |
send(IHttpRequest request,
ICallback<Result> callback,
java.lang.Class<Result> resultClass,
Body serializable)
Sends the HTTP request asynchronously
|
void |
setConnectionConfig(IConnectionConfig connectionConfig)
Set connection config for read and connect timeout in requests
|
static java.lang.String |
streamToString(java.io.InputStream input)
Reads in a stream and converts it into a string
|
public CoreHttpProvider(ISerializer serializer, IAuthenticationProvider authenticationProvider, IExecutors executors, ILogger logger)
serializer - the serializerauthenticationProvider - the authentication providerexecutors - the executorslogger - the logger for diagnostic informationpublic ISerializer getSerializer()
getSerializer in interface IHttpProviderpublic <Result,Body> void send(IHttpRequest request, ICallback<Result> callback, java.lang.Class<Result> resultClass, Body serializable)
send in interface IHttpProviderResult - the type of the response objectBody - the type of the object to send to the service in the body of the requestrequest - the request descriptioncallback - the callback to be called after success or failureresultClass - the class of the response from the serviceserializable - the object to send to the service in the body of the requestpublic <Result,Body> Result send(IHttpRequest request, java.lang.Class<Result> resultClass, Body serializable) throws ClientException
send in interface IHttpProviderResult - the type of the response objectBody - the type of the object to send to the service in the body of the requestrequest - the request descriptionresultClass - the class of the response from the serviceserializable - the object to send to the service in the body of the requestClientException - an exception occurs if the request was unable to complete for any reasonpublic <Result,Body,DeserializeType> Result send(IHttpRequest request, java.lang.Class<Result> resultClass, Body serializable, IStatefulResponseHandler<Result,DeserializeType> handler) throws ClientException
send in interface IHttpProviderResult - the type of the response objectBody - the type of the object to send to the service in the body of the requestDeserializeType - the response handler for stateful responserequest - the request descriptionresultClass - the class of the response from the serviceserializable - the object to send to the service in the body of the requesthandler - the handler for stateful responseClientException - this exception occurs if the request was unable to complete for any reasonpublic static java.lang.String streamToString(java.io.InputStream input)
input - the response body streampublic ILogger getLogger()
public IExecutors getExecutors()
public IAuthenticationProvider getAuthenticationProvider()
public IConnectionConfig getConnectionConfig()
getConnectionConfig in interface IHttpProviderpublic void setConnectionConfig(IConnectionConfig connectionConfig)
setConnectionConfig in interface IHttpProviderconnectionConfig - Connection configuration to be used for timeout values