Interface IHttpProvider<nativeRequestType>

Type Parameters:
nativeRequestType - type of a request for the native http client
All Known Implementing Classes:
CoreHttpProvider

public interface IHttpProvider<nativeRequestType>
Sends HTTP requests
  • Method Details

    • getSerializer

      @Nullable ISerializer getSerializer()
      Get the serializer for this HTTP provider
      Returns:
      the serializer for this provider
    • sendAsync

      @Nonnull <Result,​ BodyType> CompletableFuture<Result> sendAsync(@Nonnull IHttpRequest request, @Nonnull Class<Result> resultClass, @Nullable BodyType serializable)
      Sends the HTTP request asynchronously
      Type Parameters:
      Result - the type of the response object
      BodyType - the type of the object to send to the service in the body of the request
      Parameters:
      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
      Returns:
      a future with the result
    • sendAsync

      @Nullable <Result,​ BodyType,​ DeserializeType> CompletableFuture<Result> sendAsync(@Nonnull IHttpRequest request, @Nonnull Class<Result> resultClass, @Nullable BodyType serializable, @Nonnull IStatefulResponseHandler<Result,​DeserializeType> handler) throws ClientException
      Sends the HTTP request
      Type Parameters:
      Result - the expected return type return
      BodyType - the type of the object to send to the service in the body of the request
      DeserializeType - the type of the HTTP response object
      Parameters:
      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
      Returns:
      a future with the result
      Throws:
      ClientException - this exception occurs if the request was unable to complete for any reason
    • send

      @Nullable <Result,​ BodyType> Result send(@Nonnull IHttpRequest request, @Nonnull Class<Result> resultClass, @Nullable BodyType serializable) throws ClientException
      Sends the HTTP request
      Type Parameters:
      Result - the type of the response object
      BodyType - the type of the object to send to the service in the body of the request
      Parameters:
      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
      Returns:
      the result from the request
      Throws:
      ClientException - this exception occurs if the request was unable to complete for any reason
    • send

      @Nullable <Result,​ BodyType,​ DeserializeType> Result send(@Nonnull IHttpRequest request, @Nonnull Class<Result> resultClass, @Nullable BodyType serializable, @Nonnull IStatefulResponseHandler<Result,​DeserializeType> handler) throws ClientException
      Sends the HTTP request
      Type Parameters:
      Result - the expected return type return
      BodyType - the type of the object to send to the service in the body of the request
      DeserializeType - the type of the HTTP response object
      Parameters:
      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
      Returns:
      the expected result object for the request
      Throws:
      ClientException - this exception occurs if the request was unable to complete for any reason
    • getHttpRequest

      @Nullable <Result,​ BodyType> nativeRequestType getHttpRequest(@Nonnull IHttpRequest request, @Nonnull Class<Result> resultClass, @Nullable BodyType serializable) throws ClientException
      Sends the HTTP request
      Type Parameters:
      Result - the type of the response object
      BodyType - the type of the object to send to the service in the body of the request
      Parameters:
      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
      Returns:
      the result from the request
      Throws:
      ClientException - an exception occurs if the request was unable to complete for any reason