Package com.inrupt.client.spi

Service interfaces for the Inrupt Java Client Libraries.

This module provides a pluggable service provider interface, which allows the HTTP, JSON, and RDF services to be used with any concrete implementation.

One can make use of available implementation such as:

  • for HTTP processing: OkHttpService or the HttpClientService;
  • for JSON processing: JsonbService or the JacksonService;
  • for RDF processing: JenaService or the RDF4JService.

To make use of a concrete implementation make sure, first, to add the needed modules to the pom of your module. Example:


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

       HttpService client = ServiceProvider.getHttpService();
       Request request = Request.newBuilder()
       Response<byte[]> response = client.send(request, Response.BodyHandlers.ofByteArray())

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

Example of using the JSON processor fromJson() method to read a custom type:

       JsonService service = ServiceProvider.getJsonService();
       try (InputStream is = Test.class.getResourceAsStream("customType.json")) {
           CustomType obj = service.fromJson(is, CustomType.class);
           System.out.println("The CustomType Id is: " +;

Example of using the RDF service toDataset() method to read triples from a trig file into a org.apache.commons.rdf.api.Dataset:

       RdfService processor = ServiceProvider.getRdfService();
       Dataset dataset;
       try (InputStream input = Test.class.getResourceAsStream("/oneTriple.trig")) {
              dataset = processor.toDataset(RDFSyntax.TRIG, input);
       System.out.println("Number of triples in file: " + dataset.size());