Package com.inrupt.client.okhttp


package com.inrupt.client.okhttp

OkHttp bindings for the Inrupt Java Client Libraries.

A user of the OkHttpService should ensure that this implementation is available on the classpath by adding the following dependency:

     <dependency>
            <groupId>com.inrupt</groupId>
            <artifactId>inrupt-client-okhttp</artifactId>
            <version>${project.version}</version>
     </dependency>
 

Example of using the HTTP service send() method to request the Solid logo:


    HttpService client = ServiceProvider.getHttpService();
    Request request = Request.newBuilder()
        .uri("https://example.example/solid.png")
        .GET()
        .build();
    Response<byte[]> response = client.send(request, Response.BodyHandlers.ofByteArray()).toCompletableFuture().join();

    System.out.println("HTTP status code: " + response.statusCode());
    System.out.println("Response uri: " + response.uri());
    System.out.println("Content type: " + response.headers().asMap().get(CONTENT_TYPE));