From a08a0c35ebca7ca904c347b0b0c5413524c8e6d5 Mon Sep 17 00:00:00 2001 From: "Frank Schulte,OG1,,0202441468" Date: Fri, 22 Oct 2021 23:29:45 +0200 Subject: [PATCH 01/19] issue: ch4 - liberty runtime gets error on STAX interface and is in total not working. solve: ch4 - change to quarkus and only change url port to quarkus default 8080. Then ch4 endpoints are fully working! --- .gitignore | 2 + Chapter04/ch4.iml | 47 ++++ Chapter04/pom.xml | 223 +++++++++++++----- Chapter04/pom.xml.liberty | 102 ++++++++ .../book/ch4/async/MPSseConsumerResource.java | 2 +- .../book/ch4/client/JAXRSClient.java | 6 +- .../book/ch4/client/MPRestClient.java | 6 +- .../book/ch4/client/ThesaurusClient.java | 2 +- Chapter04/src/main/liberty/config/server.xml | 2 +- 9 files changed, 321 insertions(+), 71 deletions(-) create mode 100644 Chapter04/ch4.iml create mode 100644 Chapter04/pom.xml.liberty diff --git a/.gitignore b/.gitignore index e43b0f9..bbf96d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .DS_Store +.idea/.gitignore +.idea/ diff --git a/Chapter04/ch4.iml b/Chapter04/ch4.iml new file mode 100644 index 0000000..7f24656 --- /dev/null +++ b/Chapter04/ch4.iml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Chapter04/pom.xml b/Chapter04/pom.xml index a1abc1b..8e98d1b 100644 --- a/Chapter04/pom.xml +++ b/Chapter04/pom.xml @@ -1,97 +1,196 @@ - - + 4.0.0 - com.packt.microprofile - ch4 - 1.0-SNAPSHOT - war + org.acme + code-with-quarkus + 1.0.0-SNAPSHOT - 3.2 - 1.8 - 1.8 - false - [19.0.0.9,) - ch4 + 3.8.1 + true + 11 + 11 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 2.3.1.Final + 3.0.0-M5 + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + - org.eclipse - yasson - 1.0.8 + io.quarkus + quarkus-resteasy-jaxb - org.reactivestreams - reactive-streams - 1.0.3 - provided + io.quarkus + quarkus-resteasy-jsonb + + + io.quarkus + quarkus-resteasy-multipart + + + io.quarkus + quarkus-resteasy + + + + io.quarkus + quarkus-rest-client + + + io.quarkus + quarkus-rest-client-jackson + + + + + + io.quarkus + quarkus-resteasy-jackson + + + + io.quarkus + quarkus-arc + + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test - ch4 + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + ${maven.compiler.parameters} + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + - liberty + native - true + + native + - io.openliberty.tools - liberty-maven-plugin - ${openliberty.maven.version} + maven-failsafe-plugin + ${surefire-plugin.version} - package-server - package - create - install-feature - deploy - package + integration-test + verify - target/wlp-package + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + - - runnable - ${final.name} - - ${final.name} - https://server.example.com - - - - - io.jaegertracing - jaeger-client - 0.34.0 - - - org.slf4j - slf4j-jdk14 - 1.7.25 - - + + native + - + \ No newline at end of file diff --git a/Chapter04/pom.xml.liberty b/Chapter04/pom.xml.liberty new file mode 100644 index 0000000..f530bac --- /dev/null +++ b/Chapter04/pom.xml.liberty @@ -0,0 +1,102 @@ + + + 4.0.0 + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + 3.3.4 + 1.8 + 1.8 + false + ch4 + + + + org.eclipse.microprofile + microprofile + 4.1 + pom + provided + + + org.glassfish + javax.json + 1.1.4 + + + org.eclipse + yasson + 1.0.8 + + + org.reactivestreams + reactive-streams + 1.0.3 + provided + + + + ch4 + + + + liberty + + true + + + + + io.openliberty.tools + liberty-maven-plugin + ${openliberty.maven.version} + + + package-server + package + + create + install-feature + deploy + package + + + target/wlp-package + + + + + + io.openliberty.beta + openliberty-runtime + LATEST + zip + + runnable + ${final.name} + + ${final.name} + https://server.example.com + + + + + + + + io.jaegertracing + jaeger-client + 1.6.0 + + + org.slf4j + slf4j-jdk14 + 1.7.25 + + + + + diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java index 3eb1b10..819b5bc 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java @@ -22,7 +22,7 @@ public CompletionStage getCombinedSseString() { CompletableFuture stage = new CompletableFuture<>(); StringBuilder sb = new StringBuilder(); SseClient client = RestClientBuilder.newBuilder() - .baseUri(URI.create("http://localhost:9080/rest")) + .baseUri(URI.create("http://localhost:8080/rest")) .build(SseClient.class); client.receiveSSEs().subscribe(new Subscriber() { diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java index 49d3f3c..c9efca4 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java @@ -25,7 +25,7 @@ public class JAXRSClient { @GET @Path("/{word}") public String synonymsFor(@PathParam("word") String word) throws NoSuchWordException { - String uri = "http://localhost:9080/rest/thesaurus"; + String uri = "http://localhost:8080/rest/thesaurus"; Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(uri).path(word); Builder builder = target.request(MediaType.TEXT_PLAIN); @@ -48,7 +48,7 @@ public String synonymsFor(@PathParam("word") String word) throws NoSuchWordExcep @Path("/async/future/{word}") public String synonymsForAsyncFuture(@PathParam("word") String word) throws NoSuchWordException, InterruptedException, ExecutionException { - String uri = "http://localhost:9080/rest/thesaurus"; + String uri = "http://localhost:8080/rest/thesaurus"; Client client = ClientBuilder.newBuilder().build(); WebTarget target = client.target(uri).path(word); Builder builder = target.request(MediaType.TEXT_PLAIN); @@ -77,7 +77,7 @@ public String synonymsForAsyncCallback(@PathParam("words") String words) throws String[] wordsArr = words.split(","); CountDownLatch latch = new CountDownLatch(wordsArr.length); - String uri = "http://localhost:9080/rest/thesaurus"; + String uri = "http://localhost:8080/rest/thesaurus"; Client client = ClientBuilder.newBuilder().build(); for (String word : wordsArr) { WebTarget target = client.target(uri).path(word); diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java index 586e051..2d019a7 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java @@ -24,7 +24,7 @@ public class MPRestClient { @GET @Path("{word}") public String synonymsFor(@PathParam("word") String word) throws NoSuchWordException { - ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:9080/rest")) + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:8080/rest")) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); try { @@ -46,7 +46,7 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St CountDownLatch latch = new CountDownLatch(wordsArr.length); ThesaurusAsyncClient thesaurus = RestClientBuilder.newBuilder() - .baseUri(URI.create("http://localhost:9080/rest")) + .baseUri(URI.create("http://localhost:8080/rest")) .register(NoSuchWordResponseMapper.class) .build(ThesaurusAsyncClient.class); Arrays.stream(wordsArr).parallel() @@ -71,7 +71,7 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St @PostConstruct public void initThesaurus() { - ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:9080/rest")) + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:8080/rest")) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); try { diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java index f55b256..bef4b7a 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java @@ -19,7 +19,7 @@ @Path("/thesaurus/{word}") @RegisterProvider(NoSuchWordResponseMapper.class) -@RegisterRestClient(baseUri = "http://localhost:9080/rest") +@RegisterRestClient(baseUri = "http://localhost:8080/rest") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public interface ThesaurusClient { diff --git a/Chapter04/src/main/liberty/config/server.xml b/Chapter04/src/main/liberty/config/server.xml index dc5dc9a..f22e0b1 100644 --- a/Chapter04/src/main/liberty/config/server.xml +++ b/Chapter04/src/main/liberty/config/server.xml @@ -9,7 +9,7 @@ From 73d0048431c00786d515c491e6938b02cda7ed22 Mon Sep 17 00:00:00 2001 From: "Frank Schulte,OG1,,0202441468" Date: Sat, 23 Oct 2021 00:25:56 +0200 Subject: [PATCH 02/19] cleanup. --- Chapter04/ch4.iml | 47 --------- Chapter04/pom.xml.quarkus | 196 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+), 47 deletions(-) delete mode 100644 Chapter04/ch4.iml create mode 100644 Chapter04/pom.xml.quarkus diff --git a/Chapter04/ch4.iml b/Chapter04/ch4.iml deleted file mode 100644 index 7f24656..0000000 --- a/Chapter04/ch4.iml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Chapter04/pom.xml.quarkus b/Chapter04/pom.xml.quarkus new file mode 100644 index 0000000..8e98d1b --- /dev/null +++ b/Chapter04/pom.xml.quarkus @@ -0,0 +1,196 @@ + + 4.0.0 + org.acme + code-with-quarkus + 1.0.0-SNAPSHOT + + 3.8.1 + true + 11 + 11 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 2.3.1.Final + 3.0.0-M5 + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-resteasy-jaxb + + + io.quarkus + quarkus-resteasy-jsonb + + + io.quarkus + quarkus-resteasy-multipart + + + io.quarkus + quarkus-resteasy + + + + io.quarkus + quarkus-rest-client + + + io.quarkus + quarkus-rest-client-jackson + + + + + + io.quarkus + quarkus-resteasy-jackson + + + + io.quarkus + quarkus-arc + + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + ${maven.compiler.parameters} + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + native + + + native + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + + \ No newline at end of file From 76d78535e787acf1681197e97ac4ef80cf428959 Mon Sep 17 00:00:00 2001 From: "Frank Schulte,OG1,,0202441468" Date: Sat, 23 Oct 2021 00:45:14 +0200 Subject: [PATCH 03/19] cleanup. --- Chapter04/pom.xml | 56 +++------------------------------------ Chapter04/pom.xml.quarkus | 56 +++------------------------------------ 2 files changed, 8 insertions(+), 104 deletions(-) diff --git a/Chapter04/pom.xml b/Chapter04/pom.xml index 8e98d1b..beb7bff 100644 --- a/Chapter04/pom.xml +++ b/Chapter04/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.acme - code-with-quarkus - 1.0.0-SNAPSHOT + com.packt.microprofile + ch4 + 1.0-SNAPSHOT 3.8.1 true @@ -27,16 +27,6 @@ - io.quarkus quarkus-resteasy-jaxb @@ -63,53 +53,15 @@ quarkus-rest-client-jackson - - io.quarkus quarkus-resteasy-jackson - + io.quarkus quarkus-arc - io.quarkus quarkus-junit5 diff --git a/Chapter04/pom.xml.quarkus b/Chapter04/pom.xml.quarkus index 8e98d1b..beb7bff 100644 --- a/Chapter04/pom.xml.quarkus +++ b/Chapter04/pom.xml.quarkus @@ -1,8 +1,8 @@ 4.0.0 - org.acme - code-with-quarkus - 1.0.0-SNAPSHOT + com.packt.microprofile + ch4 + 1.0-SNAPSHOT 3.8.1 true @@ -27,16 +27,6 @@ - io.quarkus quarkus-resteasy-jaxb @@ -63,53 +53,15 @@ quarkus-rest-client-jackson - - io.quarkus quarkus-resteasy-jackson - + io.quarkus quarkus-arc - io.quarkus quarkus-junit5 From 4b93334495d89f102d779ff3faad6a10f0f62543 Mon Sep 17 00:00:00 2001 From: amhambra Date: Sat, 23 Oct 2021 23:33:44 +0200 Subject: [PATCH 04/19] revert: liberty pom.xml to original. --- Chapter04/pom.xml.liberty | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Chapter04/pom.xml.liberty b/Chapter04/pom.xml.liberty index f530bac..4bbc520 100644 --- a/Chapter04/pom.xml.liberty +++ b/Chapter04/pom.xml.liberty @@ -7,17 +7,18 @@ 1.0-SNAPSHOT war - 3.3.4 + 3.2 1.8 1.8 false + [19.0.0.9,) ch4 org.eclipse.microprofile microprofile - 4.1 + 4.0.1 pom provided @@ -69,12 +70,6 @@ - - io.openliberty.beta - openliberty-runtime - LATEST - zip - runnable ${final.name} @@ -89,7 +84,7 @@ io.jaegertracing jaeger-client - 1.6.0 + 0.34.0 org.slf4j @@ -99,4 +94,4 @@ - + \ No newline at end of file From d350ce27223b5c1d2c5724846e5f6530bae0bde3 Mon Sep 17 00:00:00 2001 From: amhambra Date: Sat, 23 Oct 2021 23:35:01 +0200 Subject: [PATCH 05/19] rename: liberty pom.xml to pom.liberty.orig --- Chapter04/pom.xml.liberty.orig | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Chapter04/pom.xml.liberty.orig diff --git a/Chapter04/pom.xml.liberty.orig b/Chapter04/pom.xml.liberty.orig new file mode 100644 index 0000000..4bbc520 --- /dev/null +++ b/Chapter04/pom.xml.liberty.orig @@ -0,0 +1,97 @@ + + + 4.0.0 + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + 3.2 + 1.8 + 1.8 + false + [19.0.0.9,) + ch4 + + + + org.eclipse.microprofile + microprofile + 4.0.1 + pom + provided + + + org.glassfish + javax.json + 1.1.4 + + + org.eclipse + yasson + 1.0.8 + + + org.reactivestreams + reactive-streams + 1.0.3 + provided + + + + ch4 + + + + liberty + + true + + + + + io.openliberty.tools + liberty-maven-plugin + ${openliberty.maven.version} + + + package-server + package + + create + install-feature + deploy + package + + + target/wlp-package + + + + + runnable + ${final.name} + + ${final.name} + https://server.example.com + + + + + + + + io.jaegertracing + jaeger-client + 0.34.0 + + + org.slf4j + slf4j-jdk14 + 1.7.25 + + + + + \ No newline at end of file From 069c10037c19623b9d33f7cf316b9ba2ae68f488 Mon Sep 17 00:00:00 2001 From: amhambra Date: Sat, 23 Oct 2021 23:35:15 +0200 Subject: [PATCH 06/19] rename: liberty pom.xml to pom.liberty.orig --- Chapter04/pom.xml.liberty | 97 --------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 Chapter04/pom.xml.liberty diff --git a/Chapter04/pom.xml.liberty b/Chapter04/pom.xml.liberty deleted file mode 100644 index 4bbc520..0000000 --- a/Chapter04/pom.xml.liberty +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - com.packt.microprofile - ch4 - 1.0-SNAPSHOT - war - - 3.2 - 1.8 - 1.8 - false - [19.0.0.9,) - ch4 - - - - org.eclipse.microprofile - microprofile - 4.0.1 - pom - provided - - - org.glassfish - javax.json - 1.1.4 - - - org.eclipse - yasson - 1.0.8 - - - org.reactivestreams - reactive-streams - 1.0.3 - provided - - - - ch4 - - - - liberty - - true - - - - - io.openliberty.tools - liberty-maven-plugin - ${openliberty.maven.version} - - - package-server - package - - create - install-feature - deploy - package - - - target/wlp-package - - - - - runnable - ${final.name} - - ${final.name} - https://server.example.com - - - - - - - - io.jaegertracing - jaeger-client - 0.34.0 - - - org.slf4j - slf4j-jdk14 - 1.7.25 - - - - - \ No newline at end of file From 151fd77386217400cd2ad8ce440f62705755538d Mon Sep 17 00:00:00 2001 From: amhambra Date: Sat, 23 Oct 2021 23:38:05 +0200 Subject: [PATCH 07/19] cleanup. --- Chapter06/.gitignore | 1 + Chapter06/pom.xml | 3 +-- .../book/ch6/opentracing/OutBoundTraceResource.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Chapter06/.gitignore b/Chapter06/.gitignore index 8ca4c1a..f857b6f 100644 --- a/Chapter06/.gitignore +++ b/Chapter06/.gitignore @@ -25,3 +25,4 @@ hs_err_pid* .project .settings/* /target/ +/ch6.iml diff --git a/Chapter06/pom.xml b/Chapter06/pom.xml index 4638cd4..17c6ed3 100644 --- a/Chapter06/pom.xml +++ b/Chapter06/pom.xml @@ -9,9 +9,8 @@ 3.3.4 1.8 - false 1.8 - + false ch6 diff --git a/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java b/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java index e801848..5b7d1a2 100644 --- a/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java +++ b/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java @@ -21,7 +21,7 @@ public String tracing(){ * Send a GET request to InboundTraceResource. * We'll not worry about the response. */ - client.target("http://localhost:9080/inbound/tracing").request().get(); + client.target("http://localhost:8080/inbound/tracing").request().get(); return "Sent outbound request"; } From c1bb6258d04627d9331f6b864002955a2a2af418 Mon Sep 17 00:00:00 2001 From: amhambra Date: Mon, 25 Oct 2021 04:05:43 +0200 Subject: [PATCH 08/19] add: working quarkus pom. add: working wildfly pom. change: use port 8080 and host="*" server settings. info: liberty and payara still not working. --- Chapter04/pom.xml | 148 ------------------ Chapter04/pom.xml.quarkus | 1 + Chapter04/pom.xml.wildfly | 99 ++++++++++++ .../book/ch4/client/MPRestClient.java | 3 +- Chapter04/src/main/liberty/config/server.xml | 4 + 5 files changed, 106 insertions(+), 149 deletions(-) delete mode 100644 Chapter04/pom.xml create mode 100644 Chapter04/pom.xml.wildfly diff --git a/Chapter04/pom.xml b/Chapter04/pom.xml deleted file mode 100644 index beb7bff..0000000 --- a/Chapter04/pom.xml +++ /dev/null @@ -1,148 +0,0 @@ - - 4.0.0 - com.packt.microprofile - ch4 - 1.0-SNAPSHOT - - 3.8.1 - true - 11 - 11 - UTF-8 - UTF-8 - quarkus-bom - io.quarkus.platform - 2.3.1.Final - 3.0.0-M5 - - - - - ${quarkus.platform.group-id} - ${quarkus.platform.artifact-id} - ${quarkus.platform.version} - pom - import - - - - - - io.quarkus - quarkus-resteasy-jaxb - - - io.quarkus - quarkus-resteasy-jsonb - - - io.quarkus - quarkus-resteasy-multipart - - - io.quarkus - quarkus-resteasy - - - - io.quarkus - quarkus-rest-client - - - io.quarkus - quarkus-rest-client-jackson - - - - io.quarkus - quarkus-resteasy-jackson - - - - io.quarkus - quarkus-arc - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - - - - - - ${quarkus.platform.group-id} - quarkus-maven-plugin - ${quarkus.platform.version} - true - - - - build - generate-code - generate-code-tests - - - - - - maven-compiler-plugin - ${compiler-plugin.version} - - ${maven.compiler.parameters} - - - - maven-surefire-plugin - ${surefire-plugin.version} - - - org.jboss.logmanager.LogManager - ${maven.home} - - - - - - - - native - - - native - - - - - - maven-failsafe-plugin - ${surefire-plugin.version} - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - org.jboss.logmanager.LogManager - ${maven.home} - - - - - - - - - native - - - - \ No newline at end of file diff --git a/Chapter04/pom.xml.quarkus b/Chapter04/pom.xml.quarkus index beb7bff..2413540 100644 --- a/Chapter04/pom.xml.quarkus +++ b/Chapter04/pom.xml.quarkus @@ -1,3 +1,4 @@ + 4.0.0 com.packt.microprofile diff --git a/Chapter04/pom.xml.wildfly b/Chapter04/pom.xml.wildfly new file mode 100644 index 0000000..d01ab6a --- /dev/null +++ b/Chapter04/pom.xml.wildfly @@ -0,0 +1,99 @@ + + + 4.0.0 + net.fschulte.testbed.mp + timesheetiocsv2tiki-wildfly-service-a + 1.0-SNAPSHOT + war + + 11 + 25.0.0.Final + false + 11 + timesheetiocsv2tiki-wildfly + + + + org.eclipse.microprofile + microprofile + 4.0.1 + pom + provided + + + io.vertx + vertx-auth-jwt + 3.9.5 + + + org.reactivestreams + reactive-streams + 1.0.3 + provided + + + + timesheetiocsv2tiki-wildfly + + + + wildfly + + true + + + + + org.wildfly.plugins + wildfly-jar-maven-plugin + 6.0.0.Final + + + + package + + + + + wildfly@maven(org.jboss.universe:community-universe)#${version.wildfly} + + jaxrs + microprofile-platform + microprofile-config + microprofile-fault-tolerance + microprofile-health + microprofile-jwt + microprofile-metrics + microprofile-openapi + open-tracing + microprofile-rest-client + microprofile-reactive-messaging + + + + + + + + org.jboss.spec.javax.ws.rs + jboss-jaxrs-api_2.0_spec + 1.0.1.Final + provided + + + + + jboss-public-repository + JBoss Public Maven Repository Group + https://repository.jboss.org/nexus/content/groups/public/ + + + Red Hat GA + Red Hat GA + https://maven.repository.redhat.com/ga/ + + + + + diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java index 2d019a7..d079678 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java @@ -71,7 +71,8 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St @PostConstruct public void initThesaurus() { - ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:8080/rest")) + String resourceUrl = "http://localhost:8080/rest"; + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create(resourceUrl)) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); try { diff --git a/Chapter04/src/main/liberty/config/server.xml b/Chapter04/src/main/liberty/config/server.xml index f22e0b1..98afaf8 100644 --- a/Chapter04/src/main/liberty/config/server.xml +++ b/Chapter04/src/main/liberty/config/server.xml @@ -5,10 +5,14 @@ mpRestClient-2.0 jaxrs-2.1 cdi-2.0 + From 246dc2eee3e2bdb6cb609d6ef46937810fbce4a1 Mon Sep 17 00:00:00 2001 From: amhambra Date: Mon, 25 Oct 2021 23:11:04 +0200 Subject: [PATCH 09/19] fix: RestClient injection documentation states wrong annotation to use (@RegisterRestClient). Only if you use @RestClient injection will work on WildFly, Quarkus and Liberty. fix: Consumer/Producer annotations of async/no-async clients. --- .../book/ch4/async/MPSseConsumerResource.java | 2 +- .../book/ch4/async/SseClient.java | 2 +- .../book/ch4/async/SseService.java | 3 +- .../book/ch4/cdi/MyCdiResource.java | 10 ++--- .../book/ch4/client/MPRestClient.java | 4 +- .../book/ch4/client/ThesaurusAsyncClient.java | 29 ++++++------- .../book/ch4/client/ThesaurusClient.java | 36 +++++++--------- .../book/ch4/thesaurus/ThesaurusResource.java | 43 +++++++------------ .../META-INF/microprofile-config.properties | 2 + 9 files changed, 58 insertions(+), 73 deletions(-) diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java index 819b5bc..15d5f2c 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java @@ -13,11 +13,11 @@ import org.reactivestreams.Subscription; @Path("/test") -@Produces("text/plain") public class MPSseConsumerResource { @GET @Path("/sse") + @Produces("text/plain") public CompletionStage getCombinedSseString() { CompletableFuture stage = new CompletableFuture<>(); StringBuilder sb = new StringBuilder(); diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseClient.java index b14f892..390dc2b 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseClient.java @@ -8,9 +8,9 @@ import org.reactivestreams.Publisher; @Path("/sse") -@Produces(MediaType.SERVER_SENT_EVENTS) public interface SseClient { @GET + @Produces(MediaType.SERVER_SENT_EVENTS) Publisher receiveSSEs(); } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseService.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseService.java index 0c23f70..dff1a8b 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseService.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/SseService.java @@ -14,10 +14,10 @@ import javax.ws.rs.sse.SseEventSink; @Path("/sse") -@Produces(MediaType.SERVER_SENT_EVENTS) public class SseService { @GET + @Produces(MediaType.SERVER_SENT_EVENTS) public void send3TextEvents(@Context SseEventSink sink, @Context Sse sse) { Executors.newSingleThreadExecutor().submit(() -> { try (SseEventSink sinkToClose = sink) { @@ -60,6 +60,7 @@ private void startBroadcasting(Sse sse) { @GET @Path("/broadcast") + @Produces(MediaType.SERVER_SENT_EVENTS) public void broadcast(@Context SseEventSink sink, @Context Sse sse) { startBroadcasting(sse); broadcaster.register(sink); diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java index 25fb658..f5cbbff 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java @@ -1,5 +1,9 @@ package com.packt.microprofile.book.ch4.cdi; +import com.packt.microprofile.book.ch4.client.ThesaurusClient; +import com.packt.microprofile.book.ch4.thesaurus.NoSuchWordException; +import org.eclipse.microprofile.rest.client.inject.RestClient; + import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.GET; @@ -7,16 +11,10 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import com.packt.microprofile.book.ch4.client.ThesaurusClient; -import com.packt.microprofile.book.ch4.thesaurus.NoSuchWordException; - -import org.eclipse.microprofile.rest.client.inject.RestClient; - @ApplicationScoped @Path("/cdi") @Produces("text/plain") public class MyCdiResource { - @Inject @Minimal MyDependency dependency; diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java index d079678..42932df 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java @@ -45,10 +45,12 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St String[] wordsArr = words.split(","); CountDownLatch latch = new CountDownLatch(wordsArr.length); + ThesaurusAsyncClient thesaurus = RestClientBuilder.newBuilder() .baseUri(URI.create("http://localhost:8080/rest")) - .register(NoSuchWordResponseMapper.class) + // .register(NoSuchWordResponseMapper.class) .build(ThesaurusAsyncClient.class); + Arrays.stream(wordsArr).parallel() .map(thesaurus::getSynonymsFor) .forEach(cs -> { diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java index e8e9c15..27abe5f 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java @@ -1,39 +1,38 @@ package com.packt.microprofile.book.ch4.client; -import java.util.concurrent.CompletionStage; +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.PATCH; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; +import java.util.concurrent.CompletionStage; -import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; - -@Path("/thesaurus/{word}") @RegisterProvider(NoSuchWordResponseMapper.class) -@Consumes(MediaType.TEXT_PLAIN) -@Produces(MediaType.TEXT_PLAIN) +@Path("/thesaurus/async/{word}") public interface ThesaurusAsyncClient { @GET + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) CompletionStage getSynonymsFor(@PathParam("word") String word); @POST + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) CompletionStage setSynonymsFor(@PathParam("word") String word, String synonyms); @PUT + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) CompletionStage updateSynonymsFor(@PathParam("word") String word, String synonyms); @DELETE + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) CompletionStage deleteSynonyms(@PathParam("word") String word); @PATCH + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) CompletionStage addNewSynonymsFor(@PathParam("word") String word, String newSynonyms); } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java index bef4b7a..26ecf93 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java @@ -1,46 +1,42 @@ package com.packt.microprofile.book.ch4.client; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.PATCH; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - import com.packt.microprofile.book.ch4.thesaurus.NoSuchWordException; import com.packt.microprofile.book.ch4.thesaurus.WordAlreadyExistsException; - import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; -import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; -@Path("/thesaurus/{word}") +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; + @RegisterProvider(NoSuchWordResponseMapper.class) -@RegisterRestClient(baseUri = "http://localhost:8080/rest") -@Consumes(MediaType.TEXT_PLAIN) -@Produces(MediaType.TEXT_PLAIN) +@Path("/thesaurus/{word}") public interface ThesaurusClient { - @GET + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) String getSynonymsFor(@PathParam("word") String word) throws NoSuchWordException; @POST - String setSynonymsFor(@PathParam("word") String word, + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) + String setSynonymsFor(@PathParam("word") String word, String synonyms) throws WordAlreadyExistsException; @PUT + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) String updateSynonymsFor(@PathParam("word") String word, String synonyms) throws NoSuchWordException; @DELETE + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) boolean deleteSynonyms(@PathParam("word") String word) throws NoSuchWordException; @PATCH - String addNewSynonymsFor(@PathParam("word") String word, + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) + String addNewSynonymsFor(@PathParam("word") String word, String newSynonyms) throws NoSuchWordException; } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java index 65a5bbf..774c105 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java @@ -1,64 +1,51 @@ package com.packt.microprofile.book.ch4.thesaurus; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.packt.microprofile.book.ch4.client.ThesaurusClient; +import org.eclipse.microprofile.rest.client.inject.RestClient; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.PATCH; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; +import java.util.*; -@Path ("/thesaurus/{word}") -@Consumes(MediaType.TEXT_PLAIN) -@Produces(MediaType.TEXT_PLAIN) -public class ThesaurusResource { +@RestClient +public class ThesaurusResource implements ThesaurusClient { static Map> map = new HashMap<>(); @PathParam("word") String word; - @GET - public String get() throws NoSuchWordException { + @Override + public String getSynonymsFor(String word) throws NoSuchWordException { List synonyms = map.get(word); if (synonyms == null) throw new NoSuchWordException(word); return String.join(",", synonyms); } - @POST - public String post(String synonyms) throws WordAlreadyExistsException { + @Override + public String setSynonymsFor(String word, String synonyms) throws WordAlreadyExistsException { List synonymList = new ArrayList<>(Arrays.asList(synonyms.split(","))); if (null != map.putIfAbsent(word, synonymList)) throw new WordAlreadyExistsException(word); return String.join(",", synonyms); } - @PUT - public String put(String synonyms) throws NoSuchWordException { + @Override + public String updateSynonymsFor(String word, String synonyms) throws NoSuchWordException { List synonymList = Arrays.asList(synonyms.split(",")); if (null == map.replace(word, synonymList)) throw new NoSuchWordException(word); return String.join(",", synonyms); } - @DELETE - public boolean delete() throws NoSuchWordException { + @Override + public boolean deleteSynonyms(String word) throws NoSuchWordException { if (null == map.remove(word)) throw new NoSuchWordException(word); return true; } - @PATCH - public String patch(String newSynonyms) throws NoSuchWordException { + @Override + public String addNewSynonymsFor(String word, String newSynonyms) throws NoSuchWordException { List synonyms = map.get(word); if (synonyms == null) throw new NoSuchWordException(word); diff --git a/Chapter04/src/main/resources/META-INF/microprofile-config.properties b/Chapter04/src/main/resources/META-INF/microprofile-config.properties index 8b13789..feb2979 100644 --- a/Chapter04/src/main/resources/META-INF/microprofile-config.properties +++ b/Chapter04/src/main/resources/META-INF/microprofile-config.properties @@ -1 +1,3 @@ +# RestClient +com.packt.microprofile.book.ch4.client.ThesaurusClient/mp-rest/url=http://localhost:8080/rest From c616e4e5bfc1bcc4189443f38db773929b372fcb Mon Sep 17 00:00:00 2001 From: amhambra Date: Mon, 25 Oct 2021 23:15:15 +0200 Subject: [PATCH 10/19] fix: WildFly nad Quarkus are working fully. open: Liberty and Payara have problems. add: Readme.md for each MicroProfile Runtime. --- Chapter04/README.liberty.md | 64 ++++++++++++++++++++++++++++++ Chapter04/README.payara.md | 53 +++++++++++++++++++++++++ Chapter04/README.quarkus.md | 47 ++++++++++++++++++++++ Chapter04/README.wildfly.md | 48 +++++++++++++++++++++++ Chapter04/pom.xml.payara | 78 +++++++++++++++++++++++++++++++++++++ Chapter04/pom.xml.wildfly | 8 ++-- 6 files changed, 294 insertions(+), 4 deletions(-) create mode 100644 Chapter04/README.liberty.md create mode 100644 Chapter04/README.payara.md create mode 100644 Chapter04/README.quarkus.md create mode 100644 Chapter04/README.wildfly.md create mode 100644 Chapter04/pom.xml.payara diff --git a/Chapter04/README.liberty.md b/Chapter04/README.liberty.md new file mode 100644 index 0000000..1b10b87 --- /dev/null +++ b/Chapter04/README.liberty.md @@ -0,0 +1,64 @@ +# README.liberty.md + +## Build and excute +``` +mvn -f pom.xml.liberty.orig clean package liberty:run +``` + +## Endpoints + +http://localhost:8080/ +``` +Entry page of runtime. +``` + +http://localhost:8080/ch4/rest/hello +``` +Hello World! +``` + +http://localhost:8080/ch4/rest/client/mp/funny + +**NOTE: Not working! Test data could not be loaded:** + +funny not looked up resulting in below error: +``` +result: +Kontextstammverzeichnis nicht gefunden. +Lizenziertes Material — Eigentum von Open Liberty Project, Copyright IBM Corp und andere 1997, 2019. Das Projekt wird unter den Bedingungen von Eclipse Public License v1 verteilt. + +com.packt.microprofile.book.ch4.thesaurus.NoSuchWordException: + +Expected result: +result: silly,hilarious,jovial +``` + +http://localhost:8080/ch4/rest/sse +``` +result: +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +http://localhost:8080/ch4/rest/test/sse + +**NOTE: Not working! Test data could not be loaded:** +``` +result: +Kontextstammverzeichnis nicht gefunden. +Lizenziertes Material — Eigentum von Open Liberty Project, Copyright IBM Corp und andere 1997, 2019. Das Projekt wird unter den Bedingungen von Eclipse Public License v1 verteilt. + +Expected result: +foo bar baz +``` + +# END. \ No newline at end of file diff --git a/Chapter04/README.payara.md b/Chapter04/README.payara.md new file mode 100644 index 0000000..461b4cf --- /dev/null +++ b/Chapter04/README.payara.md @@ -0,0 +1,53 @@ +# README.payara.md + +**NOTE: Payara is IN FULL NOT WORKING with this code!** +**FAIL: CDI inject of ThesaurusClient and ThesaurusAsyncClient fails on startup of server!** +Need more investigation why!** + +Disregard below details as all of them do not work: + +## Build and excute +``` +mvn -f pom.xml.payara clean package +java -jar target/ch4-microbundle.jar +``` + +## Endpoints +http://localhost:8080/rest +``` +overview page of runtime. +``` + +http://localhost:8080/rest/hello +``` +Hello World! +``` + +http://localhost:8080/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +http://localhost:8080/rest/sse +``` +result: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +http://localhost:8080/rest/test/sse +``` +result: foo bar baz +``` + +# END. \ No newline at end of file diff --git a/Chapter04/README.quarkus.md b/Chapter04/README.quarkus.md new file mode 100644 index 0000000..fdaa87f --- /dev/null +++ b/Chapter04/README.quarkus.md @@ -0,0 +1,47 @@ +# README.quarkus.md + +## Build and excute +``` +mvn -f pom.xml.quarkus clean package quarkus:dev +``` + +## Endpoints + +http://localhost:8080/rest +``` +overview page of runtime. +``` + +http://localhost:8080/rest/hello +``` +Hello World! +``` + +http://localhost:8080/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +http://localhost:8080/rest/sse +``` +result: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +http://localhost:8080/rest/test/sse +``` +result: foo bar baz +``` + +# END. \ No newline at end of file diff --git a/Chapter04/README.wildfly.md b/Chapter04/README.wildfly.md new file mode 100644 index 0000000..a12b994 --- /dev/null +++ b/Chapter04/README.wildfly.md @@ -0,0 +1,48 @@ +# README.wildfly.md + +## Build and excute +``` +mvn -f pom.xml.wildfly clean package +java -jar target/ch4-wildfly-bootable.jar +``` + +## Endpoints + +http://localhost:8080/rest +``` +overview page of runtime. +``` + +http://localhost:8080/rest/hello +``` +Hello World! +``` + +http://localhost:8080/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +http://localhost:8080/rest/sse +``` +result: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +http://localhost:8080/rest/test/sse +``` +result: foo bar baz +``` + +# END. \ No newline at end of file diff --git a/Chapter04/pom.xml.payara b/Chapter04/pom.xml.payara new file mode 100644 index 0000000..2494550 --- /dev/null +++ b/Chapter04/pom.xml.payara @@ -0,0 +1,78 @@ + + + 4.0.0 + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + 11 + false + 11 + 5.2021.8 + ch4-payara + + + + org.eclipse.microprofile + microprofile + 4.0.1 + pom + provided + + + org.reactivestreams + reactive-streams + 1.0.3 + + + + + ch4 + + + + payara-micro + + true + + + + + fish.payara.maven.plugins + payara-micro-maven-plugin + 1.4.0 + + + package + + bundle + + + + + + + + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + + + + + + + + diff --git a/Chapter04/pom.xml.wildfly b/Chapter04/pom.xml.wildfly index d01ab6a..e73c464 100644 --- a/Chapter04/pom.xml.wildfly +++ b/Chapter04/pom.xml.wildfly @@ -2,8 +2,8 @@ 4.0.0 - net.fschulte.testbed.mp - timesheetiocsv2tiki-wildfly-service-a + com.packt.microprofile + ch4 1.0-SNAPSHOT war @@ -11,7 +11,7 @@ 25.0.0.Final false 11 - timesheetiocsv2tiki-wildfly + ch4 @@ -34,7 +34,7 @@ - timesheetiocsv2tiki-wildfly + ch4-wildfly From d72f06fcb7749dbc2fe19741e8a40d858c75bef0 Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 11:53:57 +0200 Subject: [PATCH 11/19] add: REAMDE and pm files regarding microprofile liberty, quarkus and wildfly that are working with the original code after fix of the context issue. add: README.payara.md and pom.xml.payara with documenation that it can't execute the original code also after fix of the context issue. --- Chapter04/pom.xml.liberty.orig | 97 ------------------- .../META-INF/microprofile.properties | 5 + 2 files changed, 5 insertions(+), 97 deletions(-) delete mode 100644 Chapter04/pom.xml.liberty.orig create mode 100644 Chapter04/src/main/resources/META-INF/microprofile.properties diff --git a/Chapter04/pom.xml.liberty.orig b/Chapter04/pom.xml.liberty.orig deleted file mode 100644 index 4bbc520..0000000 --- a/Chapter04/pom.xml.liberty.orig +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - com.packt.microprofile - ch4 - 1.0-SNAPSHOT - war - - 3.2 - 1.8 - 1.8 - false - [19.0.0.9,) - ch4 - - - - org.eclipse.microprofile - microprofile - 4.0.1 - pom - provided - - - org.glassfish - javax.json - 1.1.4 - - - org.eclipse - yasson - 1.0.8 - - - org.reactivestreams - reactive-streams - 1.0.3 - provided - - - - ch4 - - - - liberty - - true - - - - - io.openliberty.tools - liberty-maven-plugin - ${openliberty.maven.version} - - - package-server - package - - create - install-feature - deploy - package - - - target/wlp-package - - - - - runnable - ${final.name} - - ${final.name} - https://server.example.com - - - - - - - - io.jaegertracing - jaeger-client - 0.34.0 - - - org.slf4j - slf4j-jdk14 - 1.7.25 - - - - - \ No newline at end of file diff --git a/Chapter04/src/main/resources/META-INF/microprofile.properties b/Chapter04/src/main/resources/META-INF/microprofile.properties new file mode 100644 index 0000000..db49fb7 --- /dev/null +++ b/Chapter04/src/main/resources/META-INF/microprofile.properties @@ -0,0 +1,5 @@ +# Quarkus: set same port as Liberty uses by default +quarkus.http.port=9080 +quarkus.http.test-port=9081 +quarkus.http.host=* + From 1e6d150ccc13d0dfaf971098fe06c46d1bcdc22e Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 14:16:22 +0200 Subject: [PATCH 12/19] update: mp runtimes and most of ch4 context issue fixes. open: async mp client not working. --- Chapter04/README.liberty.md | 32 ++---- Chapter04/README.payara.md | 21 ++-- Chapter04/README.quarkus.md | 12 +-- Chapter04/README.wildfly.md | 15 +-- Chapter04/pom.xml.liberty | 97 +++++++++++++++++++ Chapter04/pom.xml.payara | 35 +++---- Chapter04/pom.xml.wildfly | 3 +- .../book/ch4/async/MPSseConsumerResource.java | 4 +- .../book/ch4/client/JAXRSClient.java | 11 +-- .../book/ch4/client/MPRestClient.java | 13 ++- .../book/ch4/client/ThesaurusAsyncClient.java | 1 - Chapter04/src/main/liberty/config/server.xml | 2 +- .../META-INF/microprofile-config.properties | 3 +- .../META-INF/microprofile.properties | 5 - .../opentracing/OutBoundTraceResource.java | 2 +- 15 files changed, 163 insertions(+), 93 deletions(-) create mode 100644 Chapter04/pom.xml.liberty delete mode 100644 Chapter04/src/main/resources/META-INF/microprofile.properties diff --git a/Chapter04/README.liberty.md b/Chapter04/README.liberty.md index 1b10b87..125e68f 100644 --- a/Chapter04/README.liberty.md +++ b/Chapter04/README.liberty.md @@ -2,40 +2,31 @@ ## Build and excute ``` -mvn -f pom.xml.liberty.orig clean package liberty:run +mvn -f pom.xml.liberty clean package liberty:run ``` ## Endpoints -http://localhost:8080/ +http://localhost:9080/ ``` Entry page of runtime. ``` -http://localhost:8080/ch4/rest/hello +http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:8080/ch4/rest/client/mp/funny +http://localhost:9080/ch4/rest/client/mp/funny -**NOTE: Not working! Test data could not be loaded:** - -funny not looked up resulting in below error: ``` -result: -Kontextstammverzeichnis nicht gefunden. -Lizenziertes Material — Eigentum von Open Liberty Project, Copyright IBM Corp und andere 1997, 2019. Das Projekt wird unter den Bedingungen von Eclipse Public License v1 verteilt. - -com.packt.microprofile.book.ch4.thesaurus.NoSuchWordException: - -Expected result: result: silly,hilarious,jovial ``` -http://localhost:8080/ch4/rest/sse +http://localhost:9080/ch4/rest/sse ``` result: + event: fooEvent id: 1 data: foo @@ -49,16 +40,9 @@ id: 3 data: baz ``` -http://localhost:8080/ch4/rest/test/sse - -**NOTE: Not working! Test data could not be loaded:** +http://localhost:9080/ch4/rest/test/sse ``` -result: -Kontextstammverzeichnis nicht gefunden. -Lizenziertes Material — Eigentum von Open Liberty Project, Copyright IBM Corp und andere 1997, 2019. Das Projekt wird unter den Bedingungen von Eclipse Public License v1 verteilt. - -Expected result: -foo bar baz +result: foo bar baz ``` # END. \ No newline at end of file diff --git a/Chapter04/README.payara.md b/Chapter04/README.payara.md index 461b4cf..1a7ff23 100644 --- a/Chapter04/README.payara.md +++ b/Chapter04/README.payara.md @@ -1,34 +1,31 @@ # README.payara.md -**NOTE: Payara is IN FULL NOT WORKING with this code!** -**FAIL: CDI inject of ThesaurusClient and ThesaurusAsyncClient fails on startup of server!** -Need more investigation why!** +**NOTE: Payara is not ready to execute this code.** +**NOTE: Tested LATEST (6.2021.1.Alpha1) and 5.2021.1 till 5.2021.8 and FAILED.** +**NOTE: In case we change the code on @RestClient injection and move the @Consumes / @Produces annotations directly to the GET, PUT, POST, DELETE and UPDATE method we get it working ...** +**PROBLEM: liberty, quarkus and wíldfly microprofile runtimes are working well with the current code base unchanged.** Disregard below details as all of them do not work: ## Build and excute ``` mvn -f pom.xml.payara clean package -java -jar target/ch4-microbundle.jar +java -jar target/ch4-microbundle.jar --port 9080 --contextroot ch4 ``` ## Endpoints -http://localhost:8080/rest -``` -overview page of runtime. -``` -http://localhost:8080/rest/hello +http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:8080/rest/client/mp/funny +http://localhost:9080/ch4/rest/client/mp/funny ``` result: silly,hilarious,jovial ``` -http://localhost:8080/rest/sse +http://localhost:9080/ch4/rest/sse ``` result: @@ -45,7 +42,7 @@ id: 3 data: baz ``` -http://localhost:8080/rest/test/sse +http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` diff --git a/Chapter04/README.quarkus.md b/Chapter04/README.quarkus.md index fdaa87f..3e711fa 100644 --- a/Chapter04/README.quarkus.md +++ b/Chapter04/README.quarkus.md @@ -2,27 +2,27 @@ ## Build and excute ``` -mvn -f pom.xml.quarkus clean package quarkus:dev +mvn -Dquarkus.http.port=9080 -Dquarkus.http.root-path=ch4 -f pom.xml.quarkus clean package quarkus:dev ``` ## Endpoints -http://localhost:8080/rest +http://localhost:9080/ch4/rest ``` overview page of runtime. ``` -http://localhost:8080/rest/hello +http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:8080/rest/client/mp/funny +http://localhost:9080/ch4/rest/client/mp/funny ``` result: silly,hilarious,jovial ``` -http://localhost:8080/rest/sse +http://localhost:9080/ch4/rest/sse ``` result: @@ -39,7 +39,7 @@ id: 3 data: baz ``` -http://localhost:8080/rest/test/sse +http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` diff --git a/Chapter04/README.wildfly.md b/Chapter04/README.wildfly.md index a12b994..780255c 100644 --- a/Chapter04/README.wildfly.md +++ b/Chapter04/README.wildfly.md @@ -3,27 +3,22 @@ ## Build and excute ``` mvn -f pom.xml.wildfly clean package -java -jar target/ch4-wildfly-bootable.jar +java -jar -Djboss.http.port=9080 target/ch4-bootable.jar ``` ## Endpoints -http://localhost:8080/rest -``` -overview page of runtime. -``` - -http://localhost:8080/rest/hello +http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:8080/rest/client/mp/funny +http://localhost:9080/ch4/rest/client/mp/funny ``` result: silly,hilarious,jovial ``` -http://localhost:8080/rest/sse +http://localhost:9080/ch4/rest/sse ``` result: @@ -40,7 +35,7 @@ id: 3 data: baz ``` -http://localhost:8080/rest/test/sse +http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` diff --git a/Chapter04/pom.xml.liberty b/Chapter04/pom.xml.liberty new file mode 100644 index 0000000..a1abc1b --- /dev/null +++ b/Chapter04/pom.xml.liberty @@ -0,0 +1,97 @@ + + + 4.0.0 + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + 3.2 + 1.8 + 1.8 + false + [19.0.0.9,) + ch4 + + + + org.eclipse.microprofile + microprofile + 4.0.1 + pom + provided + + + org.glassfish + javax.json + 1.1.4 + + + org.eclipse + yasson + 1.0.8 + + + org.reactivestreams + reactive-streams + 1.0.3 + provided + + + + ch4 + + + + liberty + + true + + + + + io.openliberty.tools + liberty-maven-plugin + ${openliberty.maven.version} + + + package-server + package + + create + install-feature + deploy + package + + + target/wlp-package + + + + + runnable + ${final.name} + + ${final.name} + https://server.example.com + + + + + + + + io.jaegertracing + jaeger-client + 0.34.0 + + + org.slf4j + slf4j-jdk14 + 1.7.25 + + + + + diff --git a/Chapter04/pom.xml.payara b/Chapter04/pom.xml.payara index 2494550..3126851 100644 --- a/Chapter04/pom.xml.payara +++ b/Chapter04/pom.xml.payara @@ -10,8 +10,16 @@ 11 false 11 - 5.2021.8 - ch4-payara + + LATEST + ch4 @@ -21,18 +29,17 @@ pom provided + + io.vertx + vertx-auth-jwt + 3.9.5 + org.reactivestreams reactive-streams 1.0.3 + provided - ch4 @@ -58,17 +65,7 @@ - - - - com.packt.microprofile - ch4 - 1.0-SNAPSHOT - war - - diff --git a/Chapter04/pom.xml.wildfly b/Chapter04/pom.xml.wildfly index e73c464..01d2c1f 100644 --- a/Chapter04/pom.xml.wildfly +++ b/Chapter04/pom.xml.wildfly @@ -34,7 +34,7 @@ - ch4-wildfly + ch4 @@ -57,6 +57,7 @@ wildfly@maven(org.jboss.universe:community-universe)#${version.wildfly} + false jaxrs microprofile-platform diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java index 15d5f2c..6c33433 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java @@ -15,6 +15,8 @@ @Path("/test") public class MPSseConsumerResource { + private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest"); + @GET @Path("/sse") @Produces("text/plain") @@ -22,7 +24,7 @@ public CompletionStage getCombinedSseString() { CompletableFuture stage = new CompletableFuture<>(); StringBuilder sb = new StringBuilder(); SseClient client = RestClientBuilder.newBuilder() - .baseUri(URI.create("http://localhost:8080/rest")) + .baseUri(BASE_URI) .build(SseClient.class); client.receiveSSEs().subscribe(new Subscriber() { diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java index c9efca4..7153d29 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/JAXRSClient.java @@ -22,12 +22,13 @@ @Path("/client/jaxrs") public class JAXRSClient { + private final static String BASE_URI = "http://localhost:9080/ch4/rest/thesaurus"; + @GET @Path("/{word}") public String synonymsFor(@PathParam("word") String word) throws NoSuchWordException { - String uri = "http://localhost:8080/rest/thesaurus"; Client client = ClientBuilder.newBuilder().build(); - WebTarget target = client.target(uri).path(word); + WebTarget target = client.target(BASE_URI).path(word); Builder builder = target.request(MediaType.TEXT_PLAIN); try (Response response = builder.get()) { int status = response.getStatus(); @@ -48,9 +49,8 @@ public String synonymsFor(@PathParam("word") String word) throws NoSuchWordExcep @Path("/async/future/{word}") public String synonymsForAsyncFuture(@PathParam("word") String word) throws NoSuchWordException, InterruptedException, ExecutionException { - String uri = "http://localhost:8080/rest/thesaurus"; Client client = ClientBuilder.newBuilder().build(); - WebTarget target = client.target(uri).path(word); + WebTarget target = client.target(BASE_URI).path(word); Builder builder = target.request(MediaType.TEXT_PLAIN); AsyncInvoker invoker = builder.async(); Future future = invoker.get(); @@ -77,10 +77,9 @@ public String synonymsForAsyncCallback(@PathParam("words") String words) throws String[] wordsArr = words.split(","); CountDownLatch latch = new CountDownLatch(wordsArr.length); - String uri = "http://localhost:8080/rest/thesaurus"; Client client = ClientBuilder.newBuilder().build(); for (String word : wordsArr) { - WebTarget target = client.target(uri).path(word); + WebTarget target = client.target(BASE_URI).path(word); Builder builder = target.request(MediaType.TEXT_PLAIN); AsyncInvoker invoker = builder.async(); invoker.get(new InvocationCallback() { diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java index 42932df..d2149b9 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java @@ -21,10 +21,13 @@ @Path("/client/mp") public class MPRestClient { + // private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest/thesaurus"); + private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest"); + @GET - @Path("{word}") + @Path("sync/{word}") public String synonymsFor(@PathParam("word") String word) throws NoSuchWordException { - ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:8080/rest")) + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(BASE_URI) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); try { @@ -47,8 +50,9 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St CountDownLatch latch = new CountDownLatch(wordsArr.length); ThesaurusAsyncClient thesaurus = RestClientBuilder.newBuilder() - .baseUri(URI.create("http://localhost:8080/rest")) + .baseUri(BASE_URI) // .register(NoSuchWordResponseMapper.class) + // /thesaurus/async/{word} .build(ThesaurusAsyncClient.class); Arrays.stream(wordsArr).parallel() @@ -73,8 +77,7 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St @PostConstruct public void initThesaurus() { - String resourceUrl = "http://localhost:8080/rest"; - ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(URI.create(resourceUrl)) + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(BASE_URI) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); try { diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java index 27abe5f..1406338 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java @@ -9,7 +9,6 @@ @RegisterProvider(NoSuchWordResponseMapper.class) @Path("/thesaurus/async/{word}") public interface ThesaurusAsyncClient { - @GET @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) diff --git a/Chapter04/src/main/liberty/config/server.xml b/Chapter04/src/main/liberty/config/server.xml index 98afaf8..9814d13 100644 --- a/Chapter04/src/main/liberty/config/server.xml +++ b/Chapter04/src/main/liberty/config/server.xml @@ -13,7 +13,7 @@ diff --git a/Chapter04/src/main/resources/META-INF/microprofile-config.properties b/Chapter04/src/main/resources/META-INF/microprofile-config.properties index feb2979..0a6157d 100644 --- a/Chapter04/src/main/resources/META-INF/microprofile-config.properties +++ b/Chapter04/src/main/resources/META-INF/microprofile-config.properties @@ -1,3 +1,4 @@ # RestClient -com.packt.microprofile.book.ch4.client.ThesaurusClient/mp-rest/url=http://localhost:8080/rest +com.packt.microprofile.book.ch4.client.ThesaurusClient/mp-rest/url=http://localhost:9080/ch4/rest +com.packt.microprofile.book.ch4.client.ThesaurusAsyncClient/mp-rest/url=http://localhost:9080/ch4/rest diff --git a/Chapter04/src/main/resources/META-INF/microprofile.properties b/Chapter04/src/main/resources/META-INF/microprofile.properties deleted file mode 100644 index db49fb7..0000000 --- a/Chapter04/src/main/resources/META-INF/microprofile.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Quarkus: set same port as Liberty uses by default -quarkus.http.port=9080 -quarkus.http.test-port=9081 -quarkus.http.host=* - diff --git a/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java b/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java index 5b7d1a2..e801848 100644 --- a/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java +++ b/Chapter06/src/main/java/com/packt/microprofile/book/ch6/opentracing/OutBoundTraceResource.java @@ -21,7 +21,7 @@ public String tracing(){ * Send a GET request to InboundTraceResource. * We'll not worry about the response. */ - client.target("http://localhost:8080/inbound/tracing").request().get(); + client.target("http://localhost:9080/inbound/tracing").request().get(); return "Sent outbound request"; } From e9088acf0c3bd15077143ab86c88212079148159 Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 21:46:53 +0200 Subject: [PATCH 13/19] fix: sync/async thesauraus handling. --- .../book/ch4/async/AsyncPersonService.java | 4 +- .../book/ch4/client/MPRestClient.java | 14 ++- .../book/ch4/client/ThesaurusAsyncClient.java | 6 +- .../book/ch4/client/ThesaurusClient.java | 4 +- .../book/ch4/thesaurus/ThesaurusResource.java | 108 ++++++++++++++---- .../META-INF/microprofile-config.properties | 4 - 6 files changed, 108 insertions(+), 32 deletions(-) diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/AsyncPersonService.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/AsyncPersonService.java index 5271f38..ff1014b 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/AsyncPersonService.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/AsyncPersonService.java @@ -32,14 +32,14 @@ public AsyncPersonService() { } @GET - @Path("sync/{id}") + @Path("/sync/{id}") public Person getPersonFromDBSync(@PathParam("id") int id) throws InterruptedException, ExecutionException { Future someData = executor.submit(() -> getPerson(id)); return someData.get(); } @GET - @Path("async/{id}") + @Path("/async/{id}") public void getPersonFromDBAsync(@PathParam("id") int id, @Suspended AsyncResponse ar) { executor.submit(() -> { Optional p = Optional.ofNullable(getPerson(id)); diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java index d2149b9..fdbc188 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/MPRestClient.java @@ -21,12 +21,13 @@ @Path("/client/mp") public class MPRestClient { - // private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest/thesaurus"); - private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest"); + private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest/thesaurus"); @GET - @Path("sync/{word}") + @Path("{word}") public String synonymsFor(@PathParam("word") String word) throws NoSuchWordException { + System.out.println("CALL: com.packt.microprofile.book.ch4.client.MPRestClient.synonymsFor(word=" + word + "=)"); + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(BASE_URI) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); @@ -43,16 +44,19 @@ public String synonymsFor(@PathParam("word") String word) throws NoSuchWordExcep @GET @Path("/async/{words}") public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") String words) { + System.out.println("CALL: com.packt.microprofile.book.ch4.client.MPRestClient.synonymsForAsync(ar=, words=" + words + "=)"); + executor.submit(() -> { StringBuffer sb = new StringBuffer(); String[] wordsArr = words.split(","); CountDownLatch latch = new CountDownLatch(wordsArr.length); + // info: This is accessing the ThesaurusClient endpoint but use a different interface with same + // methods only missing the exception declarations on the signature. ThesaurusAsyncClient thesaurus = RestClientBuilder.newBuilder() .baseUri(BASE_URI) // .register(NoSuchWordResponseMapper.class) - // /thesaurus/async/{word} .build(ThesaurusAsyncClient.class); Arrays.stream(wordsArr).parallel() @@ -77,6 +81,8 @@ public void synonymsForAsync(@Suspended AsyncResponse ar, @PathParam("words") St @PostConstruct public void initThesaurus() { + System.out.println("CALL: com.packt.microprofile.book.ch4.client.MPRestClient.initThesaurus()"); + ThesaurusClient thesaurus = RestClientBuilder.newBuilder().baseUri(BASE_URI) // .register(NoSuchWordResponseMapper.class) .build(ThesaurusClient.class); diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java index 1406338..acd8694 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusAsyncClient.java @@ -1,13 +1,17 @@ package com.packt.microprofile.book.ch4.client; import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.concurrent.CompletionStage; +// info: This interface implements same methods as ThesaurusClient but without the exception declarations on the signature. +// By this it can be used in by the rest client. + +@Path("/{word}") @RegisterProvider(NoSuchWordResponseMapper.class) -@Path("/thesaurus/async/{word}") public interface ThesaurusAsyncClient { @GET @Consumes(MediaType.TEXT_PLAIN) diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java index 26ecf93..4302444 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/client/ThesaurusClient.java @@ -3,12 +3,14 @@ import com.packt.microprofile.book.ch4.thesaurus.NoSuchWordException; import com.packt.microprofile.book.ch4.thesaurus.WordAlreadyExistsException; import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; +@Path("/{word}") @RegisterProvider(NoSuchWordResponseMapper.class) -@Path("/thesaurus/{word}") +@RegisterRestClient(baseUri = "http://localhost:9080/ch4/rest/thesaurus") public interface ThesaurusClient { @GET @Consumes(MediaType.TEXT_PLAIN) diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java index 774c105..a442a0e 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java @@ -1,55 +1,123 @@ package com.packt.microprofile.book.ch4.thesaurus; -import com.packt.microprofile.book.ch4.client.ThesaurusClient; -import org.eclipse.microprofile.rest.client.inject.RestClient; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PATCH; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import java.util.*; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; -@RestClient -public class ThesaurusResource implements ThesaurusClient { +@Path ("/thesaurus/{word}") +@Consumes(MediaType.TEXT_PLAIN) +@Produces(MediaType.TEXT_PLAIN) +public class ThesaurusResource { static Map> map = new HashMap<>(); @PathParam("word") String word; - @Override - public String getSynonymsFor(String word) throws NoSuchWordException { + @GET + public synchronized String get() throws NoSuchWordException { List synonyms = map.get(word); - if (synonyms == null) + + String result = "[map=" + map + "=, word=" + word + "=, synonyms=" + synonyms + "=]"; + + if (synonyms == null) { + Exception ee = new NoSuchWordException(word); + result += " [ee=" + ee + "=]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.get() [result=" + result + "=]"); + throw new NoSuchWordException(word); + } + + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.get() [result=" + result + "=]"); + return String.join(",", synonyms); } - @Override - public String setSynonymsFor(String word, String synonyms) throws WordAlreadyExistsException { + @POST + public synchronized String post(String synonyms) throws WordAlreadyExistsException { List synonymList = new ArrayList<>(Arrays.asList(synonyms.split(","))); - if (null != map.putIfAbsent(word, synonymList)) + + String result = "[map=" + map + "=, word=" + word + "=, synonyms=" + synonyms + "=, synonymList=" + synonymList + "=]"; + + if (null != map.putIfAbsent(word, synonymList)) { + Exception ee = new WordAlreadyExistsException(word); + result += " [ee=" + ee + "=]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.post(synonyms=" + synonyms + "=) [result=" + result + "=]"); + throw new WordAlreadyExistsException(word); + } + + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.post(synonyms=" + synonyms + "=) [result=" + result + "=]"); + return String.join(",", synonyms); } - @Override - public String updateSynonymsFor(String word, String synonyms) throws NoSuchWordException { + @PUT + public synchronized String put(String synonyms) throws NoSuchWordException { List synonymList = Arrays.asList(synonyms.split(",")); - if (null == map.replace(word, synonymList)) + + String result = "[map=" + map + "=, word=" + word + "=, synonyms=" + synonyms + "=, synonymList=" + synonymList + "=]"; + + if (null == map.replace(word, synonymList)) { + Exception ee = new NoSuchWordException(word); + result += " [ee=" + ee + "=]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.put(synonyms=" + synonyms + "=) [result=" + result + "=]"); + throw new NoSuchWordException(word); + } + + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.put(synonyms=" + synonyms + "=) [result=" + result + "=]"); + return String.join(",", synonyms); } - @Override - public boolean deleteSynonyms(String word) throws NoSuchWordException { - if (null == map.remove(word)) + @DELETE + public synchronized boolean delete() throws NoSuchWordException { + String result = "[map=" + map + "=, word=" + word + "=]"; + + if (null == map.remove(word)) { + Exception ee = new NoSuchWordException(word); + result += " [ee=" + ee + "=]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.delete() [result=" + result + "=]"); + throw new NoSuchWordException(word); + } + result += " [result=true]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.delete() [result=" + result + "=]"); + return true; } - @Override - public String addNewSynonymsFor(String word, String newSynonyms) throws NoSuchWordException { + @PATCH + public synchronized String patch(String newSynonyms) throws NoSuchWordException { List synonyms = map.get(word); - if (synonyms == null) + + String result = "[map=" + map + "=, word=" + word + "=, newSynonyms=" + newSynonyms + "=, synonyms=" + synonyms + "=]"; + + if (synonyms == null) { + Exception ee = new NoSuchWordException(word); + result += " [ee=" + ee + "=]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.patch(newSynonyms=" + newSynonyms + "=) [result=" + result + "=]"); + throw new NoSuchWordException(word); + } synonyms.addAll(Arrays.asList(newSynonyms.split(","))); + + result = "[map=" + map + "=, word=" + word + "=, newSynonyms=" + newSynonyms + "=, synonyms=" + synonyms + "=]"; + System.out.println("com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.patch(newSynonyms=" + newSynonyms + "=) [result=" + result + "=]"); + return String.join(",", synonyms); } } \ No newline at end of file diff --git a/Chapter04/src/main/resources/META-INF/microprofile-config.properties b/Chapter04/src/main/resources/META-INF/microprofile-config.properties index 0a6157d..e69de29 100644 --- a/Chapter04/src/main/resources/META-INF/microprofile-config.properties +++ b/Chapter04/src/main/resources/META-INF/microprofile-config.properties @@ -1,4 +0,0 @@ -# RestClient -com.packt.microprofile.book.ch4.client.ThesaurusClient/mp-rest/url=http://localhost:9080/ch4/rest -com.packt.microprofile.book.ch4.client.ThesaurusAsyncClient/mp-rest/url=http://localhost:9080/ch4/rest - From 0a9dda0f549e72bd505973f9de937766a98d022b Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 21:50:08 +0200 Subject: [PATCH 14/19] update: liberty sample documentation for full chapter 4 endpoints. test: all chapter 4 endoioints are now working. --- Chapter04/README.liberty.md | 496 +++++++++++++++++++++++++++++++++++- 1 file changed, 494 insertions(+), 2 deletions(-) diff --git a/Chapter04/README.liberty.md b/Chapter04/README.liberty.md index 125e68f..886c17c 100644 --- a/Chapter04/README.liberty.md +++ b/Chapter04/README.liberty.md @@ -7,22 +7,127 @@ mvn -f pom.xml.liberty clean package liberty:run ## Endpoints +### front page + http://localhost:9080/ ``` Entry page of runtime. ``` +### hello world + http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:9080/ch4/rest/client/mp/funny +### beanparam +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 ``` -result: silly,hilarious,jovial +result: ID: 1234 X-SomeHeader: null path: myPath +``` + +curl with header +``` +curl "http://localhost:9080/ch4/rest/beanparam/myPath?id=1234" -H "X-SomeHeader: MyHeaderValue" + +result: ID: 1234 X-SomeHeader: MyHeaderValue path: myPath +``` + +### Person + +#### get person/0 with initial Color.RED + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} +``` + +#### PATCH: person/0?color=BLUE + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=BLUE + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### get person/0 now BLUE + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### PATCH: person/0?color=red + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=red + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} ``` +#### PATCH: person/0?color=blue + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=blue + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +### SYNC/ASYNC person + +#### SYNC + +http://localhost:9080/ch4/rest/person/sync/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +#### ASYNC + +http://localhost:9080/ch4/rest/person/async/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +### SERVER SIDE EVENTS + http://localhost:9080/ch4/rest/sse ``` result: @@ -40,9 +145,396 @@ id: 3 data: baz ``` +#### curl - server side events + +``` +curl http://localhost:9080/ch4/rest/sse + +result: +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +#### curl - server side events broadcast + +http://localhost:9080/ch4/rest/sse/broadcast +``` + UnnamedEvent +data: new registrant + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping +``` + +curl access +``` +curl http://localhost:9080/ch4/rest/sse/broadcast + +result: + UnnamedEvent +data: new registrant + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + +^C +``` + http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` +### JSON-P + +com.packt.microprofile.book.ch4.jsonp.JsonpConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=46159:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + +Process finished with exit code 0 + +``` + +#### com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=39201:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24},{"name":"Proton Torpedoes","type":"Missile","damageRating":76}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + name: Proton Torpedoes + type: Missile + damageRating: 76 + + +Process finished with exit code 0 +``` + +### JSON-B + +com.packt.microprofile.book.ch4.jsonb.JsonbConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=35817:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonb.JsonbConverter +{"hasHyperdrive":true,"name":"Coreillian Freighter","speedRating":22,"weapons":[{"damageRating":24,"name":"Quad Blaster Turret","type":"Laser"}]} + +{ + "hasHyperdrive": true, + "name": "Coreillian Freighter", + "speedRating": 22, + "weapons": [ + { + "damageRating": 24, + "name": "Quad Blaster Turret", + "type": "Laser" + } + ] +} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + +{ + "age": 25, + "familyName": "Doe", + "favouriteColour": "Green", + "firstName": "John" +} +John +null +Doe +null +0 + +Process finished with exit code 0 +``` + +### Consuming RESTful services with the MicroProfile Rest Client + +#### JAX-RS Client APIs + +see: com.packt.microprofile.book.ch4.client.JAXRSClient + +##### /client/jaxrs/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/ThisIsfunny +``` +result: ThisIsfunny +``` + +##### /client/jaxrs/async/future/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/async/future/ThisIsfunnyTooButAynsJaxRs +``` +result: ThisIsfunnyTooButAynsJaxRs +``` + +##### /client/jaxrs/async/callback/{words} + +First call below url to load the words and synonyms into the service: + +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +Then execute this url that finds for word *funny* and *loud* the synonyms but not the other two: + +http://localhost:9080/ch4/rest/client/jaxrs/async/callback/funny,JaxRsAsyncWord2,loud,JaxRsAsyncWord3 +``` +result: silly,hilarious,jovial cacophonous +``` + +See logging output from the runtime: + +``` +>>> 15 GET http://localhost:9080/ch4/rest/thesaurus/funny null +[INFO] <<< 15 http://localhost:9080/ch4/rest/thesaurus/funny silly,hilarious,jovial +[INFO] >>> 16 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 null +[INFO] <<< 16 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 JaxRsAsyncWord2 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] >>> 17 GET http://localhost:9080/ch4/rest/thesaurus/loud null +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +[INFO] <<< 17 http://localhost:9080/ch4/rest/thesaurus/loud cacophonous +[INFO] >>> 18 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 null +[INFO] <<< 18 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 JaxRsAsyncWord3 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +``` + +#### MicroProfile Rest Client + +##### SYNC - ThesaurusClient - /client/mp/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +ThesaurusClient / ThesaurusResource + +@GET / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.getSynonymsFor + +@POST / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.setSynonymsFor + +@PUT / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.updateSynonymsFor + +@DELETE / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.deleteSynonyms + +@PATCH / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.addNewSynonymsFor + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funnyXX +``` +result: funnyXX +``` + +##### ASYNC - ThesaurusClient - /client/mp/thesaurus/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/loud,UnKnown,funny +``` +NOTE: UnKnown not found getting "unable to complete request" + +result: cacophonous silly,hilarious,jovial unable to complete request +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/funnyXX +``` +result: unable to complete request +``` + +#### headerpropagation + +no working example: only code to look at that is not complete. + +see: com.packt.microprofile.book.ch4.headerpropagation.AirlineReservationClient + +not available: +http://localhost:9080/ch4/rest/AirlineReservationClient + +#### dynamicbinding + +see: com.packt.microprofile.book.ch4.dynamicbinding.DynamicResource + +no working example: only code to look at that is not complete. + +not available: +http://localhost:9080/ch4/rest/dynamic + +#### cdi + +see: com.packt.microprofile.book.ch4.cdi.MyCdiResource + +http://localhost:9080/ch4/rest/cdi +``` +result: -2147483648 + +result: from log + +[INFO] >>> 1 GET http://localhost:9080/ch4/rest/cdi null +[INFO] com.packt.microprofile.book.ch4.cdi.SomeOtherBean.produceDependency() [return new MyProducedDependency(intRandom=0);] +[INFO] CONSTRUCTOR: com.packt.microprofile.book.ch4.cdi.MyProducedDependency.MyProducedDependency(randomNumber=0=) +[INFO] com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl.getInstanceId() [return Integer.MIN_VALUE=-2147483648=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getDependencyInstanceId(): [dependency=com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl@562fe0dc=] [result=-2147483648=] +[INFO] <<< 1 http://localhost:9080/ch4/rest/cdi -2147483648 +``` + + +http://localhost:9080/ch4/rest/cdi/produced +``` +result: 0 + +result: from log + +[INFO] >>> 5 GET http://localhost:9080/ch4/rest/cdi/produced null +[INFO] com.packt.microprofile.book.ch4.cdi.MyProducedDependency.getRandomNumber() [return randomNumber=0=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getProducedDependencyRandomNum(): [producedDependency=com.packt.microprofile.book.ch4.cdi.MyProducedDependency@2de3a06a=] [result=0=] +[INFO] <<< 5 http://localhost:9080/ch4/rest/cdi/produced 0 +``` + +### cdi thesaurus + +first thesaurus need to load data: + +http://localhost:9080/ch4/rest/client/mp/async/funny + +then check for word: funny + +http://localhost:9080/ch4/rest/cdi/thesaurus/funny +``` +result: silly,hilarious,jovial +``` + +then check for word: funnyXXX + +http://localhost:9080/ch4/rest/cdi/thesaurus/funnyXXX +``` +result: Sorry, that word is not found. +``` + # END. \ No newline at end of file From 458e5277225c0b87f978aa1d5038fff2d0ade755 Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 21:50:43 +0200 Subject: [PATCH 15/19] add: logging to see what happens. --- Chapter04/.gitignore | 2 ++ .../book/ch4/cdi/MyCdiResource.java | 24 ++++++++++++++----- .../book/ch4/cdi/MyDependencyImpl.java | 2 ++ .../book/ch4/cdi/MyOtherDependencyImpl.java | 2 ++ .../book/ch4/cdi/MyProducedDependency.java | 4 ++++ .../book/ch4/cdi/MyThirdDependencyImpl.java | 2 ++ .../book/ch4/cdi/SomeOtherBean.java | 6 ++++- 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Chapter04/.gitignore b/Chapter04/.gitignore index 31ca4f1..37059a6 100644 --- a/Chapter04/.gitignore +++ b/Chapter04/.gitignore @@ -24,3 +24,5 @@ hs_err_pid* .classpath .project .settings/* +.iml +.idea/* \ No newline at end of file diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java index f5cbbff..e7ddf94 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyCdiResource.java @@ -24,15 +24,21 @@ public class MyCdiResource { @GET public int getDependencyInstanceId() { - System.out.println(dependency); - return dependency.getInstanceId(); + int result = dependency.getInstanceId(); + + System.out.println("com.packt.microprofile.book.ch4.cdi.MyCdiResource.getDependencyInstanceId(): [dependency=" + dependency + "=] [result=" + result + "=]"); + + return result; } @GET @Path("/produced") public int getProducedDependencyRandomNum() { - System.out.println(producedDependency); - return producedDependency.getRandomNumber(); + int result = producedDependency.getRandomNumber(); + + System.out.println("com.packt.microprofile.book.ch4.cdi.MyCdiResource.getProducedDependencyRandomNum(): [producedDependency=" + producedDependency + "=] [result=" + result + "=]"); + + return result; } @Inject @@ -42,10 +48,16 @@ public int getProducedDependencyRandomNum() { @GET @Path("/thesaurus/{word}") public String lookup(@PathParam("word") String word) { + String result = "Sorry, that word is not found."; + try { - return thesaurusClient.getSynonymsFor(word); + result = thesaurusClient.getSynonymsFor(word); } catch (NoSuchWordException ex) { - return "Sorry, that word is not found."; + // ignore, take default response } + + System.out.println("com.packt.microprofile.book.ch4.cdi.MyCdiResource.lookup(word=" + word + "=): [thesaurusClient=" + thesaurusClient + "=] [result=" + result + "=]"); + + return result; } } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyDependencyImpl.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyDependencyImpl.java index 803a686..6db5bb5 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyDependencyImpl.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyDependencyImpl.java @@ -11,6 +11,8 @@ public class MyDependencyImpl implements MyDependency { @Override public int getInstanceId() { + System.out.println("com.packt.microprofile.book.ch4.cdi.MyDependencyImpl.getInstanceId() [return instanceId=" + instanceId + "=]"); + return instanceId; } } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyOtherDependencyImpl.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyOtherDependencyImpl.java index a13cace..6e9739a 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyOtherDependencyImpl.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyOtherDependencyImpl.java @@ -9,6 +9,8 @@ public class MyOtherDependencyImpl implements MyDependency { @Override public int getInstanceId() { + System.out.println("com.packt.microprofile.book.ch4.cdi.MyOtherDependencyImpl.getInstanceId() [return Integer.MAX_VALUE=" + Integer.MAX_VALUE + "=]"); + return Integer.MAX_VALUE; } } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyProducedDependency.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyProducedDependency.java index b7ff258..13d2354 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyProducedDependency.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyProducedDependency.java @@ -5,10 +5,14 @@ public class MyProducedDependency { private final int randomNumber; MyProducedDependency(int randomNumber) { + System.out.println("CONSTRUCTOR: com.packt.microprofile.book.ch4.cdi.MyProducedDependency.MyProducedDependency(randomNumber=" + randomNumber + "=)"); + this.randomNumber = randomNumber; } public int getRandomNumber() { + System.out.println("com.packt.microprofile.book.ch4.cdi.MyProducedDependency.getRandomNumber() [return randomNumber=" + randomNumber + "=]"); + return randomNumber; } } diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyThirdDependencyImpl.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyThirdDependencyImpl.java index c7046d8..bdb9b10 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyThirdDependencyImpl.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/MyThirdDependencyImpl.java @@ -8,6 +8,8 @@ public class MyThirdDependencyImpl implements MyDependency { @Override public int getInstanceId() { + System.out.println("com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl.getInstanceId() [return Integer.MIN_VALUE=" + Integer.MIN_VALUE + "=]"); + return Integer.MIN_VALUE; } } \ No newline at end of file diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/SomeOtherBean.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/SomeOtherBean.java index 63aaeb6..40771c5 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/SomeOtherBean.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/cdi/SomeOtherBean.java @@ -8,6 +8,10 @@ public class SomeOtherBean { @Produces public MyProducedDependency produceDependency() { - return new MyProducedDependency((int) (Math.random() * 10)); + int intRandom = (int) (Math.random() * 10); + + System.out.println("com.packt.microprofile.book.ch4.cdi.SomeOtherBean.produceDependency() [return new MyProducedDependency(intRandom=" + intRandom + ");]"); + + return new MyProducedDependency(intRandom); } } From 4f90b08f20abbc08b1a4c0a00907b58bc20980d6 Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 22:06:12 +0200 Subject: [PATCH 16/19] fixed: ASYNC - ThesaurusAsyncClient - /client/mp/async/{word} --- Chapter04/README.liberty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter04/README.liberty.md b/Chapter04/README.liberty.md index 886c17c..f173dcb 100644 --- a/Chapter04/README.liberty.md +++ b/Chapter04/README.liberty.md @@ -442,7 +442,7 @@ http://localhost:9080/ch4/rest/client/mp/funnyXX result: funnyXX ``` -##### ASYNC - ThesaurusClient - /client/mp/thesaurus/{word} +##### ASYNC - ThesaurusAsyncClient - /client/mp/async/{word} *Client:* From 8a34c9138bb5140962bd89715df89ef617bdc8fa Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 23:15:08 +0200 Subject: [PATCH 17/19] test: liberty ok. test: wildfily ok. test: quarkus ok but one endpojnt fails: http://localhost:9080/ch4/rest/client/jaxrs/async/callback/funny,JaxRsAsyncWord2,loud,JaxRsAsyncWord3 giving erratic result not expected! test: payara ERROR. Nothing works as ch4 deployment fails on CDI injection. update: README for liberty, wildfly, quarkus and payara. --- Chapter04/README.liberty.md | 2 +- Chapter04/README.payara.md | 515 +++++++++++++++++++++++++++++++++++- Chapter04/README.quarkus.md | 474 ++++++++++++++++++++++++++++++++- Chapter04/README.wildfly.md | 465 +++++++++++++++++++++++++++++++- 4 files changed, 1448 insertions(+), 8 deletions(-) diff --git a/Chapter04/README.liberty.md b/Chapter04/README.liberty.md index f173dcb..474a282 100644 --- a/Chapter04/README.liberty.md +++ b/Chapter04/README.liberty.md @@ -1,6 +1,6 @@ # README.liberty.md -## Build and excute +## Build and execute ``` mvn -f pom.xml.liberty clean package liberty:run ``` diff --git a/Chapter04/README.payara.md b/Chapter04/README.payara.md index 1a7ff23..2f3c368 100644 --- a/Chapter04/README.payara.md +++ b/Chapter04/README.payara.md @@ -1,13 +1,31 @@ # README.payara.md **NOTE: Payara is not ready to execute this code.** + **NOTE: Tested LATEST (6.2021.1.Alpha1) and 5.2021.1 till 5.2021.8 and FAILED.** + **NOTE: In case we change the code on @RestClient injection and move the @Consumes / @Produces annotations directly to the GET, PUT, POST, DELETE and UPDATE method we get it working ...** + **PROBLEM: liberty, quarkus and wíldfly microprofile runtimes are working well with the current code base unchanged.** +**ERROR:** + +```aidl +2021-10-27T23:05:30.166+0200] [] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1635368730166] [levelValue: 1000] [[ + Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type ThesaurusClient with qualifiers @RestClient + at injection point [BackedAnnotatedField] @Inject @RestClient com.packt.microprofile.book.ch4.cdi.MyCdiResource.thesaurusClient + at com.packt.microprofile.book.ch4.cdi.MyCdiResource.thesaurusClient(MyCdiResource.java:0) + -- WELD-001408: Unsatisfied dependencies for type ThesaurusClient with qualifiers @RestClient + at injection point [BackedAnnotatedField] @Inject @RestClient com.packt.microprofile.book.ch4.cdi.MyCdiResource.thesaurusClient + at com.packt.microprofile.book.ch4.cdi.MyCdiResource.thesaurusClient(MyCdiResource.java:0) +]] + + +``` + Disregard below details as all of them do not work: -## Build and excute +## Build and execute ``` mvn -f pom.xml.payara clean package java -jar target/ch4-microbundle.jar --port 9080 --contextroot ch4 @@ -15,15 +33,119 @@ java -jar target/ch4-microbundle.jar --port 9080 --contextroot ch4 ## Endpoints +### hello world + http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:9080/ch4/rest/client/mp/funny +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 ``` -result: silly,hilarious,jovial +result: ID: 1234 X-SomeHeader: null path: myPath +``` + +curl with header ``` +curl "http://localhost:9080/ch4/rest/beanparam/myPath?id=1234" -H "X-SomeHeader: MyHeaderValue" + +result: ID: 1234 X-SomeHeader: MyHeaderValue path: myPath +``` + +### Person + +#### get person/0 with initial Color.RED + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} +``` + +#### PATCH: person/0?color=BLUE + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=BLUE + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### get person/0 now BLUE + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### PATCH: person/0?color=red + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=red + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} +``` + +#### PATCH: person/0?color=blue + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=blue + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +### SYNC/ASYNC person + +#### SYNC + +http://localhost:9080/ch4/rest/person/sync/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +#### ASYNC + +http://localhost:9080/ch4/rest/person/async/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +### SERVER SIDE EVENTS http://localhost:9080/ch4/rest/sse ``` @@ -42,9 +164,396 @@ id: 3 data: baz ``` +#### curl - server side events + +``` +curl http://localhost:9080/ch4/rest/sse + +result: +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +#### curl - server side events broadcast + +http://localhost:9080/ch4/rest/sse/broadcast +``` + UnnamedEvent +data: new registrant + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping +``` + +curl access +``` +curl http://localhost:9080/ch4/rest/sse/broadcast + +result: + UnnamedEvent +data: new registrant + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + + UnnamedEvent +data: ping + +^C +``` + http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` +### JSON-P + +com.packt.microprofile.book.ch4.jsonp.JsonpConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=46159:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + +Process finished with exit code 0 + +``` + +#### com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=39201:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24},{"name":"Proton Torpedoes","type":"Missile","damageRating":76}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + name: Proton Torpedoes + type: Missile + damageRating: 76 + + +Process finished with exit code 0 +``` + +### JSON-B + +com.packt.microprofile.book.ch4.jsonb.JsonbConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=35817:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonb.JsonbConverter +{"hasHyperdrive":true,"name":"Coreillian Freighter","speedRating":22,"weapons":[{"damageRating":24,"name":"Quad Blaster Turret","type":"Laser"}]} + +{ + "hasHyperdrive": true, + "name": "Coreillian Freighter", + "speedRating": 22, + "weapons": [ + { + "damageRating": 24, + "name": "Quad Blaster Turret", + "type": "Laser" + } + ] +} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + +{ + "age": 25, + "familyName": "Doe", + "favouriteColour": "Green", + "firstName": "John" +} +John +null +Doe +null +0 + +Process finished with exit code 0 +``` + +### Consuming RESTful services with the MicroProfile Rest Client + +#### JAX-RS Client APIs + +see: com.packt.microprofile.book.ch4.client.JAXRSClient + +##### /client/jaxrs/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/ThisIsfunny +``` +result: ThisIsfunny +``` + +##### /client/jaxrs/async/future/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/async/future/ThisIsfunnyTooButAynsJaxRs +``` +result: ThisIsfunnyTooButAynsJaxRs +``` + +##### /client/jaxrs/async/callback/{words} + +First call below url to load the words and synonyms into the service: + +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +Then execute this url that finds for word *funny* and *loud* the synonyms but not the other two: + +http://localhost:9080/ch4/rest/client/jaxrs/async/callback/funny,JaxRsAsyncWord2,loud,JaxRsAsyncWord3 +``` +result: silly,hilarious,jovial cacophonous +``` + +See logging output from the runtime: + +``` +>>> 15 GET http://localhost:9080/ch4/rest/thesaurus/funny null +[INFO] <<< 15 http://localhost:9080/ch4/rest/thesaurus/funny silly,hilarious,jovial +[INFO] >>> 16 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 null +[INFO] <<< 16 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 JaxRsAsyncWord2 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] >>> 17 GET http://localhost:9080/ch4/rest/thesaurus/loud null +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +[INFO] <<< 17 http://localhost:9080/ch4/rest/thesaurus/loud cacophonous +[INFO] >>> 18 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 null +[INFO] <<< 18 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 JaxRsAsyncWord3 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +``` + +#### MicroProfile Rest Client + +##### SYNC - ThesaurusClient - /client/mp/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +ThesaurusClient / ThesaurusResource + +@GET / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.getSynonymsFor + +@POST / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.setSynonymsFor + +@PUT / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.updateSynonymsFor + +@DELETE / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.deleteSynonyms + +@PATCH / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.addNewSynonymsFor + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funnyXX +``` +result: funnyXX +``` + +##### ASYNC - ThesaurusAsyncClient - /client/mp/async/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/loud,UnKnown,funny +``` +NOTE: UnKnown not found getting "unable to complete request" + +result: cacophonous silly,hilarious,jovial unable to complete request +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/funnyXX +``` +result: unable to complete request +``` + +#### headerpropagation + +no working example: only code to look at that is not complete. + +see: com.packt.microprofile.book.ch4.headerpropagation.AirlineReservationClient + +not available: +http://localhost:9080/ch4/rest/AirlineReservationClient + +#### dynamicbinding + +see: com.packt.microprofile.book.ch4.dynamicbinding.DynamicResource + +no working example: only code to look at that is not complete. + +not available: +http://localhost:9080/ch4/rest/dynamic + +#### cdi + +see: com.packt.microprofile.book.ch4.cdi.MyCdiResource + +http://localhost:9080/ch4/rest/cdi +``` +result: -2147483648 + +result: from log + +[INFO] >>> 1 GET http://localhost:9080/ch4/rest/cdi null +[INFO] com.packt.microprofile.book.ch4.cdi.SomeOtherBean.produceDependency() [return new MyProducedDependency(intRandom=0);] +[INFO] CONSTRUCTOR: com.packt.microprofile.book.ch4.cdi.MyProducedDependency.MyProducedDependency(randomNumber=0=) +[INFO] com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl.getInstanceId() [return Integer.MIN_VALUE=-2147483648=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getDependencyInstanceId(): [dependency=com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl@562fe0dc=] [result=-2147483648=] +[INFO] <<< 1 http://localhost:9080/ch4/rest/cdi -2147483648 +``` + + +http://localhost:9080/ch4/rest/cdi/produced +``` +result: 0 + +result: from log + +[INFO] >>> 5 GET http://localhost:9080/ch4/rest/cdi/produced null +[INFO] com.packt.microprofile.book.ch4.cdi.MyProducedDependency.getRandomNumber() [return randomNumber=0=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getProducedDependencyRandomNum(): [producedDependency=com.packt.microprofile.book.ch4.cdi.MyProducedDependency@2de3a06a=] [result=0=] +[INFO] <<< 5 http://localhost:9080/ch4/rest/cdi/produced 0 +``` + +### cdi thesaurus + +first thesaurus need to load data: + +http://localhost:9080/ch4/rest/client/mp/async/funny + +then check for word: funny + +http://localhost:9080/ch4/rest/cdi/thesaurus/funny +``` +result: silly,hilarious,jovial +``` + +then check for word: funnyXXX + +http://localhost:9080/ch4/rest/cdi/thesaurus/funnyXXX +``` +result: Sorry, that word is not found. +``` + # END. \ No newline at end of file diff --git a/Chapter04/README.quarkus.md b/Chapter04/README.quarkus.md index 3e711fa..bdf15ef 100644 --- a/Chapter04/README.quarkus.md +++ b/Chapter04/README.quarkus.md @@ -7,20 +7,126 @@ mvn -Dquarkus.http.port=9080 -Dquarkus.http.root-path=ch4 -f pom.xml.quarkus cle ## Endpoints +### rest summary page + http://localhost:9080/ch4/rest ``` overview page of runtime. ``` +### hello world + http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:9080/ch4/rest/client/mp/funny +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 ``` -result: silly,hilarious,jovial +result: ID: 1234 X-SomeHeader: null path: myPath +``` + +curl with header +``` +curl "http://localhost:9080/ch4/rest/beanparam/myPath?id=1234" -H "X-SomeHeader: MyHeaderValue" + +result: ID: 1234 X-SomeHeader: MyHeaderValue path: myPath +``` + +### Person + +#### get person/0 with initial Color.RED + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} +``` + +#### PATCH: person/0?color=BLUE + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=BLUE + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### get person/0 now BLUE + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### PATCH: person/0?color=red + ``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=red + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} +``` + +#### PATCH: person/0?color=blue + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=blue + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +### SYNC/ASYNC person + +#### SYNC + +http://localhost:9080/ch4/rest/person/sync/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +#### ASYNC + +http://localhost:9080/ch4/rest/person/async/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +### SERVER SIDE EVENTS http://localhost:9080/ch4/rest/sse ``` @@ -39,9 +145,373 @@ id: 3 data: baz ``` +#### curl - server side events + +``` +curl http://localhost:9080/ch4/rest/sse + +result: +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +#### curl - server side events broadcast + +NOTE: Quarkus does not show this *UnnamedEvent* that liberty show. + +http://localhost:9080/ch4/rest/sse/broadcast +``` +data: new registrant + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping +``` + +curl access +``` +curl http://localhost:9080/ch4/rest/sse/broadcast + +result: +data: new registrant + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping + +^C +``` + http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` +### JSON-P + +com.packt.microprofile.book.ch4.jsonp.JsonpConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=46159:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + +Process finished with exit code 0 + +``` + +#### com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=39201:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24},{"name":"Proton Torpedoes","type":"Missile","damageRating":76}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + name: Proton Torpedoes + type: Missile + damageRating: 76 + + +Process finished with exit code 0 +``` + +### JSON-B + +com.packt.microprofile.book.ch4.jsonb.JsonbConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=35817:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonb.JsonbConverter +{"hasHyperdrive":true,"name":"Coreillian Freighter","speedRating":22,"weapons":[{"damageRating":24,"name":"Quad Blaster Turret","type":"Laser"}]} + +{ + "hasHyperdrive": true, + "name": "Coreillian Freighter", + "speedRating": 22, + "weapons": [ + { + "damageRating": 24, + "name": "Quad Blaster Turret", + "type": "Laser" + } + ] +} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + +{ + "age": 25, + "familyName": "Doe", + "favouriteColour": "Green", + "firstName": "John" +} +John +null +Doe +null +0 + +Process finished with exit code 0 +``` + +### Consuming RESTful services with the MicroProfile Rest Client + +#### JAX-RS Client APIs + +see: com.packt.microprofile.book.ch4.client.JAXRSClient + +##### /client/jaxrs/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/ThisIsfunny +``` +result: ThisIsfunny +``` + +##### /client/jaxrs/async/future/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/async/future/ThisIsfunnyTooButAynsJaxRs +``` +result: ThisIsfunnyTooButAynsJaxRs +``` + +##### /client/jaxrs/async/callback/{words} + +First call below url to load the words and synonyms into the service: + +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +Then execute this url that finds for word *funny* and *loud* the synonyms but not the other two: + +**NOTE: Quarkus is working erratic and response on multiple requests in a row with the asked for result, but not coming in one request all valid words.** +**OPEN: To be investigated.** + +http://localhost:9080/ch4/rest/client/jaxrs/async/callback/funny,JaxRsAsyncWord2,loud,JaxRsAsyncWord3 +``` +result: silly,hilarious,jovial cacophonous +``` + +See logging output from the runtime: + +``` +>>> 15 GET http://localhost:9080/ch4/rest/thesaurus/funny null +[INFO] <<< 15 http://localhost:9080/ch4/rest/thesaurus/funny silly,hilarious,jovial +[INFO] >>> 16 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 null +[INFO] <<< 16 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 JaxRsAsyncWord2 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] >>> 17 GET http://localhost:9080/ch4/rest/thesaurus/loud null +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +[INFO] <<< 17 http://localhost:9080/ch4/rest/thesaurus/loud cacophonous +[INFO] >>> 18 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 null +[INFO] <<< 18 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 JaxRsAsyncWord3 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +``` + +#### MicroProfile Rest Client + +##### SYNC - ThesaurusClient - /client/mp/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +ThesaurusClient / ThesaurusResource + +@GET / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.getSynonymsFor + +@POST / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.setSynonymsFor + +@PUT / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.updateSynonymsFor + +@DELETE / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.deleteSynonyms + +@PATCH / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.addNewSynonymsFor + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funnyXX +``` +result: funnyXX +``` + +##### ASYNC - ThesaurusAsyncClient - /client/mp/async/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +**@GET existing word with synonyms:** + +**NOTE: Quarkus is working erratic and response on multiple requests in a row with the asked for result, but not coming in one request all valid words.** +**OPEN: To be investigated.** + +http://localhost:9080/ch4/rest/client/mp/async/loud,UnKnown,funny +``` +NOTE: UnKnown not found getting "unable to complete request" + +result: cacophonous silly,hilarious,jovial unable to complete request +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/funnyXX +``` +result: unable to complete request +``` + +#### headerpropagation + +no working example: only code to look at that is not complete. + +see: com.packt.microprofile.book.ch4.headerpropagation.AirlineReservationClient + +not available: +http://localhost:9080/ch4/rest/AirlineReservationClient + +#### dynamicbinding + +see: com.packt.microprofile.book.ch4.dynamicbinding.DynamicResource + +no working example: only code to look at that is not complete. + +not available: +http://localhost:9080/ch4/rest/dynamic + +#### cdi + +see: com.packt.microprofile.book.ch4.cdi.MyCdiResource + +http://localhost:9080/ch4/rest/cdi +``` +result: -2147483648 + +result: from log + +[INFO] >>> 1 GET http://localhost:9080/ch4/rest/cdi null +[INFO] com.packt.microprofile.book.ch4.cdi.SomeOtherBean.produceDependency() [return new MyProducedDependency(intRandom=0);] +[INFO] CONSTRUCTOR: com.packt.microprofile.book.ch4.cdi.MyProducedDependency.MyProducedDependency(randomNumber=0=) +[INFO] com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl.getInstanceId() [return Integer.MIN_VALUE=-2147483648=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getDependencyInstanceId(): [dependency=com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl@562fe0dc=] [result=-2147483648=] +[INFO] <<< 1 http://localhost:9080/ch4/rest/cdi -2147483648 +``` + + +http://localhost:9080/ch4/rest/cdi/produced +``` +result: 0 + +result: from log + +[INFO] >>> 5 GET http://localhost:9080/ch4/rest/cdi/produced null +[INFO] com.packt.microprofile.book.ch4.cdi.MyProducedDependency.getRandomNumber() [return randomNumber=0=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getProducedDependencyRandomNum(): [producedDependency=com.packt.microprofile.book.ch4.cdi.MyProducedDependency@2de3a06a=] [result=0=] +[INFO] <<< 5 http://localhost:9080/ch4/rest/cdi/produced 0 +``` + +### cdi thesaurus + +first thesaurus need to load data: + +http://localhost:9080/ch4/rest/client/mp/async/funny + +then check for word: funny + +http://localhost:9080/ch4/rest/cdi/thesaurus/funny +``` +result: silly,hilarious,jovial +``` + +then check for word: funnyXXX + +http://localhost:9080/ch4/rest/cdi/thesaurus/funnyXXX +``` +result: Sorry, that word is not found. +``` + # END. \ No newline at end of file diff --git a/Chapter04/README.wildfly.md b/Chapter04/README.wildfly.md index 780255c..6ac9c4e 100644 --- a/Chapter04/README.wildfly.md +++ b/Chapter04/README.wildfly.md @@ -8,16 +8,120 @@ java -jar -Djboss.http.port=9080 target/ch4-bootable.jar ## Endpoints +### hello world + http://localhost:9080/ch4/rest/hello ``` Hello World! ``` -http://localhost:9080/ch4/rest/client/mp/funny +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 ``` -result: silly,hilarious,jovial +result: ID: 1234 X-SomeHeader: null path: myPath +``` + +curl with header +``` +curl "http://localhost:9080/ch4/rest/beanparam/myPath?id=1234" -H "X-SomeHeader: MyHeaderValue" + +result: ID: 1234 X-SomeHeader: MyHeaderValue path: myPath +``` + +### Person + +#### get person/0 with initial Color.RED + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} ``` +#### PATCH: person/0?color=BLUE + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=BLUE + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### get person/0 now BLUE + +http://localhost:9080/ch4/rest/person/0 +``` +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +#### PATCH: person/0?color=red + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=red + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"RED" +} +``` + +#### PATCH: person/0?color=blue + +``` +curl -v -X PATCH http://localhost:9080/ch4/rest/person/0?color=blue + +result: { + "firstName": "John", + "lastName": "Doe", + "age": 33, + "favoriteColor":"BLUE" +} +``` + +### SYNC/ASYNC person + +#### SYNC + +http://localhost:9080/ch4/rest/person/sync/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +#### ASYNC + +http://localhost:9080/ch4/rest/person/async/1 +``` +result: { + "firstName": "Richard", + "lastName": "Smith", + "age": 21, + "favoriteColor":"ORANGE" +} +``` + +### SERVER SIDE EVENTS + http://localhost:9080/ch4/rest/sse ``` result: @@ -35,9 +139,366 @@ id: 3 data: baz ``` +#### curl - server side events + +``` +curl http://localhost:9080/ch4/rest/sse + +result: +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +id: 3 +data: baz +``` + +#### curl - server side events broadcast + +NOTE: WildFly does not show this *UnnamedEvent* that liberty show. + +http://localhost:9080/ch4/rest/sse/broadcast +``` +data: new registrant + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping +``` + +curl access +``` +curl http://localhost:9080/ch4/rest/sse/broadcast + +result: +data: new registrant + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping + +data: ping + +^C +``` + http://localhost:9080/ch4/rest/test/sse ``` result: foo bar baz ``` +### JSON-P + +com.packt.microprofile.book.ch4.jsonp.JsonpConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=46159:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + +Process finished with exit code 0 + +``` + +#### com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=39201:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonp.JsonpStreamingConverter +{"name":"Coreillian Freighter","hasHyperdrive":true,"speedRating":22,"weapons":[{"name":"Quad Blaster Turret","type":"Laser","damageRating":24},{"name":"Proton Torpedoes","type":"Missile","damageRating":76}]} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + name: Proton Torpedoes + type: Missile + damageRating: 76 + + +Process finished with exit code 0 +``` + +### JSON-B + +com.packt.microprofile.book.ch4.jsonb.JsonbConverter.main + +In IDE click on main method and execute: +``` +result: + +/home/fschute/.sdkman/candidates/java/11.0.11-zulu/bin/java -javaagent:/opt/idea-IC-211.7628.21/lib/idea_rt.jar=35817:/opt/idea-IC-211.7628.21/bin -Dfile.encoding=UTF-8 -classpath /home/fschute/_work/_prj/book/Practical-Cloud-Native-Java-Development-with-MicroProfile/Chapter04/target/classes:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jaxb/2.3.1.Final/quarkus-resteasy-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxb/2.3.1.Final/quarkus-jaxb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jaxp/2.3.1.Final/quarkus-jaxp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.3-b02/jaxb-runtime-2.3.3-b02.jar:/home/fschute/.m2/repository/org/glassfish/jaxb/txw2/2.3.3-b02/txw2-2.3.3-b02.jar:/home/fschute/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.10/istack-commons-runtime-3.0.10.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/4.7.0.Final/resteasy-jaxb-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec/2.0.0.Final/jboss-jaxb-api_2.3_spec-2.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jsonb/2.3.1.Final/quarkus-resteasy-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonb/2.3.1.Final/quarkus-jsonb-2.3.1.Final.jar:/home/fschute/.m2/repository/org/eclipse/yasson/1.0.9/yasson-1.0.9.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jsonp/2.3.1.Final/quarkus-jsonp-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/4.7.0.Final/resteasy-json-binding-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/glassfish/jakarta.json/1.1.6/jakarta.json-1.1.6.jar:/home/fschute/.m2/repository/jakarta/json/bind/jakarta.json.bind-api/1.0.2/jakarta.json.bind-api-1.0.2.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-json-p-provider/4.7.0.Final/resteasy-json-p-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-multipart/2.3.1.Final/quarkus-resteasy-multipart-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-multipart-provider/4.7.0.Final/resteasy-multipart-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core-spi/4.7.0.Final/resteasy-core-spi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.1_spec/2.0.1.Final/jboss-jaxrs-api_2.1_spec-2.0.1.Final.jar:/home/fschute/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-core/4.7.0.Final/resteasy-core-4.7.0.Final.jar:/home/fschute/.m2/repository/com/ibm/async/asyncutil/0.1.0/asyncutil-0.1.0.jar:/home/fschute/.m2/repository/com/sun/mail/jakarta.mail/1.6.5/jakarta.mail-1.6.5.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-dom/0.8.3/apache-mime4j-dom-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-core/0.8.3/apache-mime4j-core-0.8.3.jar:/home/fschute/.m2/repository/org/apache/james/apache-mime4j-storage/0.8.3/apache-mime4j-storage-0.8.3.jar:/home/fschute/.m2/repository/org/jboss/logging/commons-logging-jboss-logging/1.0.0.Final/commons-logging-jboss-logging-1.0.0.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy/2.3.1.Final/quarkus-resteasy-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http/2.3.1.Final/quarkus-vertx-http-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-security-runtime-spi/2.3.1.Final/quarkus-security-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-mutiny/2.3.1.Final/quarkus-mutiny-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny/1.1.1/mutiny-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-smallrye-context-propagation/2.3.1.Final/quarkus-smallrye-context-propagation-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation/1.2.0/smallrye-context-propagation-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-api/1.2.0/smallrye-context-propagation-api-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-context-propagation-storage/1.2.0/smallrye-context-propagation-storage-1.2.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/mutiny-smallrye-context-propagation/1.1.1/mutiny-smallrye-context-propagation-1.1.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx-http-dev-console-runtime-spi/2.3.1.Final/quarkus-vertx-http-dev-console-runtime-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/security/quarkus-security/1.1.4.Final/quarkus-security-1.1.4.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-vertx/2.3.1.Final/quarkus-vertx-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-netty/2.3.1.Final/quarkus-netty-2.3.1.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-haproxy/4.1.68.Final/netty-codec-haproxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-annotation/1.6.0/smallrye-common-annotation-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-core/2.13.0/smallrye-mutiny-vertx-core-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-runtime/2.13.0/smallrye-mutiny-vertx-runtime-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/vertx-mutiny-generator/2.13.0/vertx-mutiny-generator-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-codegen/4.1.4/vertx-codegen-4.1.4.jar:/home/fschute/.m2/repository/io/smallrye/smallrye-fault-tolerance-vertx/5.2.1/smallrye-fault-tolerance-vertx-5.2.1.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web/2.13.0/smallrye-mutiny-vertx-web-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-web-common/2.13.0/smallrye-mutiny-vertx-web-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-auth-common/2.13.0/smallrye-mutiny-vertx-auth-common-2.13.0.jar:/home/fschute/.m2/repository/io/smallrye/reactive/smallrye-mutiny-vertx-bridge-common/2.13.0/smallrye-mutiny-vertx-bridge-common-2.13.0.jar:/home/fschute/.m2/repository/io/vertx/vertx-web/4.1.4/vertx-web-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-web-common/4.1.4/vertx-web-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-auth-common/4.1.4/vertx-auth-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-bridge-common/4.1.4/vertx-bridge-common-4.1.4.jar:/home/fschute/.m2/repository/io/vertx/vertx-core/4.1.4/vertx-core-4.1.4.jar:/home/fschute/.m2/repository/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-server-common/2.3.1.Final/quarkus-resteasy-server-common-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client/2.3.1.Final/quarkus-rest-client-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-core/2.3.1.Final/quarkus-core-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/home/fschute/.m2/repository/jakarta/enterprise/jakarta.enterprise.cdi-api/2.0.2/jakarta.enterprise.cdi-api-2.0.2.jar:/home/fschute/.m2/repository/jakarta/el/jakarta.el-api/3.0.3/jakarta.el-api-3.0.3.jar:/home/fschute/.m2/repository/jakarta/inject/jakarta.inject-api/1.0/jakarta.inject-api-1.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-ide-launcher/2.3.1.Final/quarkus-ide-launcher-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-development-mode-spi/2.3.1.Final/quarkus-development-mode-spi-2.3.1.Final.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config/2.5.1/smallrye-config-2.5.1.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-core/2.5.1/smallrye-config-core-2.5.1.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/config/microprofile-config-api/2.0/microprofile-config-api-2.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-expression/1.6.0/smallrye-common-expression-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-function/1.6.0/smallrye-common-function-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-constraint/1.6.0/smallrye-common-constraint-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-classloader/1.6.0/smallrye-common-classloader-1.6.0.jar:/home/fschute/.m2/repository/io/smallrye/config/smallrye-config-common/2.5.1/smallrye-config-common-2.5.1.jar:/home/fschute/.m2/repository/org/jboss/logmanager/jboss-logmanager-embedded/1.0.9/jboss-logmanager-embedded-1.0.9.jar:/home/fschute/.m2/repository/org/jboss/logging/jboss-logging-annotations/2.2.1.Final/jboss-logging-annotations-2.2.1.Final.jar:/home/fschute/.m2/repository/org/jboss/threads/jboss-threads/3.4.2.Final/jboss-threads-3.4.2.Final.jar:/home/fschute/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/home/fschute/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar:/home/fschute/.m2/repository/org/graalvm/sdk/graal-sdk/21.2.0/graal-sdk-21.2.0.jar:/home/fschute/.m2/repository/org/wildfly/common/wildfly-common/1.5.4.Final-format-001/wildfly-common-1.5.4.Final-format-001.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-bootstrap-runner/2.3.1.Final/quarkus-bootstrap-runner-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-common/2.3.1.Final/quarkus-resteasy-common-2.3.1.Final.jar:/home/fschute/.m2/repository/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-apache-httpclient/2.3.1.Final/quarkus-apache-httpclient-2.3.1.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile/4.7.0.Final/resteasy-client-microprofile-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-microprofile-base/4.7.0.Final/resteasy-client-microprofile-base-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client/4.7.0.Final/resteasy-client-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-client-api/4.7.0.Final/resteasy-client-api-4.7.0.Final.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-cdi/4.7.0.Final/resteasy-cdi-4.7.0.Final.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/rest/client/microprofile-rest-client-api/2.0/microprofile-rest-client-api-2.0.jar:/home/fschute/.m2/repository/jakarta/interceptor/jakarta.interceptor-api/1.2.5/jakarta.interceptor-api-1.2.5.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore/4.4.14/httpcore-4.4.14.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.14/httpcore-nio-4.4.14.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-rest-client-jackson/2.3.1.Final/quarkus-rest-client-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-jackson/2.3.1.Final/quarkus-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.12.5/jackson-datatype-jdk8-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.12.5/jackson-module-parameter-names-2.12.5.jar:/home/fschute/.m2/repository/org/jboss/resteasy/resteasy-jackson2-provider/4.7.0.Final/resteasy-jackson2-provider-4.7.0.Final.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.12.5/jackson-jaxrs-json-provider-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.12.5/jackson-jaxrs-base-2.12.5.jar:/home/fschute/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar:/home/fschute/.m2/repository/com/github/java-json-tools/json-patch/1.13/json-patch-1.13.jar:/home/fschute/.m2/repository/com/github/java-json-tools/msg-simple/1.2/msg-simple-1.2.jar:/home/fschute/.m2/repository/com/github/java-json-tools/btf/1.3/btf-1.3.jar:/home/fschute/.m2/repository/com/github/java-json-tools/jackson-coreutils/2.0/jackson-coreutils-2.0.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-resteasy-jackson/2.3.1.Final/quarkus-resteasy-jackson-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/quarkus-arc/2.3.1.Final/quarkus-arc-2.3.1.Final.jar:/home/fschute/.m2/repository/io/quarkus/arc/arc/2.3.1.Final/arc-2.3.1.Final.jar:/home/fschute/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/home/fschute/.m2/repository/org/eclipse/microprofile/context-propagation/microprofile-context-propagation-api/1.2/microprofile-context-propagation-api-1.2.jar:/home/fschute/.m2/repository/io/smallrye/common/smallrye-common-io/1.6.0/smallrye-common-io-1.6.0.jar:/home/fschute/.m2/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar:/home/fschute/.m2/repository/commons-codec/commons-codec/1.15/commons-codec-1.15.jar com.packt.microprofile.book.ch4.jsonb.JsonbConverter +{"hasHyperdrive":true,"name":"Coreillian Freighter","speedRating":22,"weapons":[{"damageRating":24,"name":"Quad Blaster Turret","type":"Laser"}]} + +{ + "hasHyperdrive": true, + "name": "Coreillian Freighter", + "speedRating": 22, + "weapons": [ + { + "damageRating": 24, + "name": "Quad Blaster Turret", + "type": "Laser" + } + ] +} +name: Coreillian Freighter +hasHyperdrive: true +speedRating: 22 +weapons: + name: Quad Blaster Turret + type: Laser + damageRating: 24 + + +{ + "age": 25, + "familyName": "Doe", + "favouriteColour": "Green", + "firstName": "John" +} +John +null +Doe +null +0 + +Process finished with exit code 0 +``` + +### Consuming RESTful services with the MicroProfile Rest Client + +#### JAX-RS Client APIs + +see: com.packt.microprofile.book.ch4.client.JAXRSClient + +##### /client/jaxrs/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/ThisIsfunny +``` +result: ThisIsfunny +``` + +##### /client/jaxrs/async/future/{word} + +http://localhost:9080/ch4/rest/client/jaxrs/async/future/ThisIsfunnyTooButAynsJaxRs +``` +result: ThisIsfunnyTooButAynsJaxRs +``` + +##### /client/jaxrs/async/callback/{words} + +First call below url to load the words and synonyms into the service: + +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +Then execute this url that finds for word *funny* and *loud* the synonyms but not the other two: + +http://localhost:9080/ch4/rest/client/jaxrs/async/callback/funny,JaxRsAsyncWord2,loud,JaxRsAsyncWord3 +``` +result: silly,hilarious,jovial cacophonous +``` + +See logging output from the runtime: + +``` +>>> 15 GET http://localhost:9080/ch4/rest/thesaurus/funny null +[INFO] <<< 15 http://localhost:9080/ch4/rest/thesaurus/funny silly,hilarious,jovial +[INFO] >>> 16 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 null +[INFO] <<< 16 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord2 JaxRsAsyncWord2 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] >>> 17 GET http://localhost:9080/ch4/rest/thesaurus/loud null +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +[INFO] <<< 17 http://localhost:9080/ch4/rest/thesaurus/loud cacophonous +[INFO] >>> 18 GET http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 null +[INFO] <<< 18 http://localhost:9080/ch4/rest/thesaurus/JaxRsAsyncWord3 JaxRsAsyncWord3 +[INFO] [err] javax.ws.rs.NotFoundException: HTTP 404 Not Found +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) +[INFO] [err] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) +[INFO] [err] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) +[INFO] [err] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) +[INFO] [err] at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:179) +[INFO] [err] at [internal classes] +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) +[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) +[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:829) +``` + +#### MicroProfile Rest Client + +##### SYNC - ThesaurusClient - /client/mp/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +ThesaurusClient / ThesaurusResource + +@GET / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.getSynonymsFor + +@POST / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.setSynonymsFor + +@PUT / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.updateSynonymsFor + +@DELETE / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.deleteSynonyms + +@PATCH / com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource.addNewSynonymsFor + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funny +``` +result: silly,hilarious,jovial +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/funnyXX +``` +result: funnyXX +``` + +##### ASYNC - ThesaurusAsyncClient - /client/mp/async/{word} + +*Client:* + +See: com.packt.microprofile.book.ch4.client.MPRestClient + +See: com.packt.microprofile.book.ch4.client.ThesaurusClient + +*Implementation:* + +See: com.packt.microprofile.book.ch4.thesaurus.ThesaurusResource + +**@GET existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/loud,UnKnown,funny +``` +NOTE: UnKnown not found getting "unable to complete request" + +result: cacophonous silly,hilarious,jovial unable to complete request +``` + +**@GET not existing word with synonyms:** +http://localhost:9080/ch4/rest/client/mp/async/funnyXX +``` +result: unable to complete request +``` + +#### headerpropagation + +no working example: only code to look at that is not complete. + +see: com.packt.microprofile.book.ch4.headerpropagation.AirlineReservationClient + +not available: +http://localhost:9080/ch4/rest/AirlineReservationClient + +#### dynamicbinding + +see: com.packt.microprofile.book.ch4.dynamicbinding.DynamicResource + +no working example: only code to look at that is not complete. + +not available: +http://localhost:9080/ch4/rest/dynamic + +#### cdi + +see: com.packt.microprofile.book.ch4.cdi.MyCdiResource + +http://localhost:9080/ch4/rest/cdi +``` +result: -2147483648 + +result: from log + +[INFO] >>> 1 GET http://localhost:9080/ch4/rest/cdi null +[INFO] com.packt.microprofile.book.ch4.cdi.SomeOtherBean.produceDependency() [return new MyProducedDependency(intRandom=0);] +[INFO] CONSTRUCTOR: com.packt.microprofile.book.ch4.cdi.MyProducedDependency.MyProducedDependency(randomNumber=0=) +[INFO] com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl.getInstanceId() [return Integer.MIN_VALUE=-2147483648=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getDependencyInstanceId(): [dependency=com.packt.microprofile.book.ch4.cdi.MyThirdDependencyImpl@562fe0dc=] [result=-2147483648=] +[INFO] <<< 1 http://localhost:9080/ch4/rest/cdi -2147483648 +``` + + +http://localhost:9080/ch4/rest/cdi/produced +``` +result: 0 + +result: from log + +[INFO] >>> 5 GET http://localhost:9080/ch4/rest/cdi/produced null +[INFO] com.packt.microprofile.book.ch4.cdi.MyProducedDependency.getRandomNumber() [return randomNumber=0=] +[INFO] com.packt.microprofile.book.ch4.cdi.MyCdiResource.getProducedDependencyRandomNum(): [producedDependency=com.packt.microprofile.book.ch4.cdi.MyProducedDependency@2de3a06a=] [result=0=] +[INFO] <<< 5 http://localhost:9080/ch4/rest/cdi/produced 0 +``` + +### cdi thesaurus + +first thesaurus need to load data: + +http://localhost:9080/ch4/rest/client/mp/async/funny + +then check for word: funny + +http://localhost:9080/ch4/rest/cdi/thesaurus/funny +``` +result: silly,hilarious,jovial +``` + +then check for word: funnyXXX + +http://localhost:9080/ch4/rest/cdi/thesaurus/funnyXXX +``` +result: Sorry, that word is not found. +``` + # END. \ No newline at end of file From 104fb684a72687d8baea61fe8c0bcc3f72a17cf2 Mon Sep 17 00:00:00 2001 From: amhambra Date: Wed, 27 Oct 2021 23:35:07 +0200 Subject: [PATCH 18/19] revert: synchronized on ThesaurusResource methods. note: libertiy is fully predictable working. the words coming back in the row they are in the input parameter. note: wildfly is mostly predictable working. the words coming back in different ordering and changing ordering different as they are in the input parameter. note: quarkus is fully unreliable. It does not return the expected result. Sometimes it is right. Sometimes nothing comes back or only a section of the result from the input parameter values. --- .../book/ch4/thesaurus/ThesaurusResource.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java index a442a0e..1ab78c0 100644 --- a/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java +++ b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/thesaurus/ThesaurusResource.java @@ -27,7 +27,7 @@ public class ThesaurusResource { String word; @GET - public synchronized String get() throws NoSuchWordException { + public String get() throws NoSuchWordException { List synonyms = map.get(word); String result = "[map=" + map + "=, word=" + word + "=, synonyms=" + synonyms + "=]"; @@ -46,7 +46,7 @@ public synchronized String get() throws NoSuchWordException { } @POST - public synchronized String post(String synonyms) throws WordAlreadyExistsException { + public String post(String synonyms) throws WordAlreadyExistsException { List synonymList = new ArrayList<>(Arrays.asList(synonyms.split(","))); String result = "[map=" + map + "=, word=" + word + "=, synonyms=" + synonyms + "=, synonymList=" + synonymList + "=]"; @@ -65,7 +65,7 @@ public synchronized String post(String synonyms) throws WordAlreadyExistsExcepti } @PUT - public synchronized String put(String synonyms) throws NoSuchWordException { + public String put(String synonyms) throws NoSuchWordException { List synonymList = Arrays.asList(synonyms.split(",")); String result = "[map=" + map + "=, word=" + word + "=, synonyms=" + synonyms + "=, synonymList=" + synonymList + "=]"; @@ -84,7 +84,7 @@ public synchronized String put(String synonyms) throws NoSuchWordException { } @DELETE - public synchronized boolean delete() throws NoSuchWordException { + public boolean delete() throws NoSuchWordException { String result = "[map=" + map + "=, word=" + word + "=]"; if (null == map.remove(word)) { @@ -101,7 +101,7 @@ public synchronized boolean delete() throws NoSuchWordException { } @PATCH - public synchronized String patch(String newSynonyms) throws NoSuchWordException { + public String patch(String newSynonyms) throws NoSuchWordException { List synonyms = map.get(word); String result = "[map=" + map + "=, word=" + word + "=, newSynonyms=" + newSynonyms + "=, synonyms=" + synonyms + "=]"; From e68c0d8cc9ea51aeea0759baa64d8b7fac91146d Mon Sep 17 00:00:00 2001 From: amhambra Date: Thu, 28 Oct 2021 00:06:16 +0200 Subject: [PATCH 19/19] cleanup. --- Chapter04/.gitignore | 4 ++-- Chapter04/src/main/liberty/config/server.xml | 3 --- Chapter06/.gitignore | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Chapter04/.gitignore b/Chapter04/.gitignore index 37059a6..f9472af 100644 --- a/Chapter04/.gitignore +++ b/Chapter04/.gitignore @@ -24,5 +24,5 @@ hs_err_pid* .classpath .project .settings/* -.iml -.idea/* \ No newline at end of file +*.iml +.idea/* diff --git a/Chapter04/src/main/liberty/config/server.xml b/Chapter04/src/main/liberty/config/server.xml index 9814d13..a37f9f7 100644 --- a/Chapter04/src/main/liberty/config/server.xml +++ b/Chapter04/src/main/liberty/config/server.xml @@ -5,9 +5,6 @@ mpRestClient-2.0 jaxrs-2.1 cdi-2.0 - diff --git a/Chapter06/.gitignore b/Chapter06/.gitignore index f857b6f..eaeeb3b 100644 --- a/Chapter06/.gitignore +++ b/Chapter06/.gitignore @@ -25,4 +25,5 @@ hs_err_pid* .project .settings/* /target/ -/ch6.iml +*.iml +.idea/*