public class DefaultHttpProvider extends java.lang.Object implements IHttpProvider
| Constructor and Description |
|---|
DefaultHttpProvider(ISerializer serializer,
IRequestInterceptor requestInterceptor,
IExecutors executors,
ILogger logger)
Creates the DefaultHttpProvider.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
static java.lang.String |
streamToString(java.io.InputStream input)
Reads in a stream and converts it into a string.
|
public DefaultHttpProvider(ISerializer serializer, IRequestInterceptor requestInterceptor, IExecutors executors, ILogger logger)
serializer - The serializer.requestInterceptor - The request interceptor.executors - The executors.logger - The logger for diagnostic information.public 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 object.Body - The type of the object to send to the service in the body of the request.request - The request description.callback - The callback to be called after success or failure.resultClass - The class of the response from the service.serializable - The object to send to the service in the body of the request.public <Result,Body> Result send(IHttpRequest request, java.lang.Class<Result> resultClass, Body serializable) throws ClientException
send in interface IHttpProviderResult - The type of the response object.Body - The type of the object to send to the service in the body of the request.request - The request description.resultClass - The class of the response from the service.serializable - The object to send to the service in the body of the request.ClientException - An exception occurs if the request was unable to complete for any reason.public <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 object.Body - The type of the object to send to the service in the body of the request.DeserializeType - The response handler for stateful response.request - The request description.resultClass - The class of the response from the service.serializable - The object to send to the service in the body of the request.handler - The handler for stateful response.ClientException - This exception occurs if the request was unable to complete for any reason.public static java.lang.String streamToString(java.io.InputStream input)
input - The response body stream.