Package com.inrupt.client.httpclient
package com.inrupt.client.httpclient
HttpClient
bindings for the Inrupt Java Client Libraries.
A user of the HttpClientService
should ensure that this implementation is
available on the classpath by adding the following dependency:
<dependency> <groupId>com.inrupt</groupId> <artifactId>inrupt-client-httpclient</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));