Class OkHttpService

java.lang.Object
com.inrupt.client.okhttp.OkHttpService
All Implemented Interfaces:
HttpService

public class OkHttpService extends Object implements HttpService
A HttpService using the okhttp3.OkHttpClient.
  • Constructor Details

    • OkHttpService

      public OkHttpService()
      Create an HTTP client service with a default OkHttpClient.
  • Method Details

    • send

      public <T> CompletionStage<Response<T>> send(Request request, Response.BodyHandler<T> handler)
      Description copied from interface: HttpService
      Perform an asynchonous HTTP request.
      Specified by:
      send in interface HttpService
      Type Parameters:
      T - the response type
      Parameters:
      request - the request
      handler - the response body handler
      Returns:
      the next stage of completion, containing the response
    • ofOkHttpClient

      public static OkHttpService ofOkHttpClient(OkHttpClient client)
      Create an HTTP client service with a pre-configured OkHttpClient.
      Parameters:
      client - the OkHttpClient
      Returns:
      an HTTP client service