Package com.inrupt.client.okhttp
Class OkHttpService
java.lang.Object
com.inrupt.client.okhttp.OkHttpService
- All Implemented Interfaces:
HttpService
A
HttpService
using the okhttp3.OkHttpClient
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic OkHttpService
ofOkHttpClient
(OkHttpClient client) Create an HTTP client service with a pre-configuredOkHttpClient
.<T> CompletionStage<Response<T>>
send
(Request request, Response.BodyHandler<T> handler) Perform an asynchonous HTTP request.
-
Constructor Details
-
OkHttpService
public OkHttpService()Create an HTTP client service with a defaultOkHttpClient
.
-
-
Method Details
-
send
Description copied from interface:HttpService
Perform an asynchonous HTTP request.- Specified by:
send
in interfaceHttpService
- Type Parameters:
T
- the response type- Parameters:
request
- the requesthandler
- the response body handler- Returns:
- the next stage of completion, containing the response
-
ofOkHttpClient
Create an HTTP client service with a pre-configuredOkHttpClient
.- Parameters:
client
- the OkHttpClient- Returns:
- an HTTP client service
-