Skip to content

Java HTTP Client

The restclient-classic-java11 module uses the JDK's java.net.http.HttpClient to call the posts service. It sends asynchronous requests and maps response bodies with JSON-B.

Inspect the client

PostResourceClient builds an HTTP/2 client and calls the service with sendAsync. It parses count responses as text and converts JSON response bodies to Java objects with an injected Jsonb instance. The module includes RESTEasy Classic and JSON-B, but the outbound calls use the JDK HTTP client.

The sample currently uses http://localhost:8080 in its request URIs. The application.properties sets the local Quarkus HTTP port to 8081.

Run the client

Start the posts service on port 8080, then run the client from restclient-classic-java11:

./mvnw quarkus:dev

On Windows, run mvnw.cmd quarkus:dev.

What's next