diff --git a/.gitignore b/.gitignore index 071e81c..18082cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.idea/ .vscode/* **/.project -**/.classpath \ No newline at end of file +**/.classpath diff --git a/Chapter04/.gitignore b/Chapter04/.gitignore index 31ca4f1..f9472af 100644 --- a/Chapter04/.gitignore +++ b/Chapter04/.gitignore @@ -24,3 +24,5 @@ hs_err_pid* .classpath .project .settings/* +*.iml +.idea/* diff --git a/Chapter04/README.liberty.md b/Chapter04/README.liberty.md new file mode 100644 index 0000000..474a282 --- /dev/null +++ b/Chapter04/README.liberty.md @@ -0,0 +1,540 @@ +# README.liberty.md + +## Build and execute +``` +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! +``` + +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 +``` +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: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +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.payara.md b/Chapter04/README.payara.md new file mode 100644 index 0000000..2f3c368 --- /dev/null +++ b/Chapter04/README.payara.md @@ -0,0 +1,559 @@ +# 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 execute +``` +mvn -f pom.xml.payara clean package +java -jar target/ch4-microbundle.jar --port 9080 --contextroot ch4 +``` + +## Endpoints + +### hello world + +http://localhost:9080/ch4/rest/hello +``` +Hello World! +``` + +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 +``` +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: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +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 new file mode 100644 index 0000000..bdf15ef --- /dev/null +++ b/Chapter04/README.quarkus.md @@ -0,0 +1,517 @@ +# README.quarkus.md + +## Build and excute +``` +mvn -Dquarkus.http.port=9080 -Dquarkus.http.root-path=ch4 -f pom.xml.quarkus clean package quarkus:dev +``` + +## Endpoints + +### rest summary page + +http://localhost:9080/ch4/rest +``` +overview page of runtime. +``` + +### hello world + +http://localhost:9080/ch4/rest/hello +``` +Hello World! +``` + +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 +``` +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: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +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 new file mode 100644 index 0000000..6ac9c4e --- /dev/null +++ b/Chapter04/README.wildfly.md @@ -0,0 +1,504 @@ +# README.wildfly.md + +## Build and excute +``` +mvn -f pom.xml.wildfly clean package +java -jar -Djboss.http.port=9080 target/ch4-bootable.jar +``` + +## Endpoints + +### hello world + +http://localhost:9080/ch4/rest/hello +``` +Hello World! +``` + +### beanparam + +http://localhost:9080/ch4/rest/beanparam/myPath?id=1234 +``` +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: + +event: fooEvent +id: 1 +data: foo + +event: barEvent +id: 2 +data: bar + +event: bazEvent +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 diff --git a/Chapter04/pom.xml b/Chapter04/pom.xml.liberty similarity index 100% rename from Chapter04/pom.xml rename to Chapter04/pom.xml.liberty diff --git a/Chapter04/pom.xml.payara b/Chapter04/pom.xml.payara new file mode 100644 index 0000000..3126851 --- /dev/null +++ b/Chapter04/pom.xml.payara @@ -0,0 +1,75 @@ + + + 4.0.0 + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + 11 + false + 11 + + LATEST + ch4 + + + + 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 + + + + ch4 + + + + payara-micro + + true + + + + + fish.payara.maven.plugins + payara-micro-maven-plugin + 1.4.0 + + + package + + bundle + + + + + ${payaraVersion} + + + + + + + diff --git a/Chapter04/pom.xml.quarkus b/Chapter04/pom.xml.quarkus new file mode 100644 index 0000000..2413540 --- /dev/null +++ b/Chapter04/pom.xml.quarkus @@ -0,0 +1,149 @@ + + + 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.wildfly b/Chapter04/pom.xml.wildfly new file mode 100644 index 0000000..01d2c1f --- /dev/null +++ b/Chapter04/pom.xml.wildfly @@ -0,0 +1,100 @@ + + + 4.0.0 + com.packt.microprofile + ch4 + 1.0-SNAPSHOT + war + + 11 + 25.0.0.Final + false + 11 + ch4 + + + + 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 + + + + ch4 + + + + wildfly + + true + + + + + org.wildfly.plugins + wildfly-jar-maven-plugin + 6.0.0.Final + + + + package + + + + + wildfly@maven(org.jboss.universe:community-universe)#${version.wildfly} + false + + 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/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/async/MPSseConsumerResource.java b/Chapter04/src/main/java/com/packt/microprofile/book/ch4/async/MPSseConsumerResource.java index 20a3f69..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 @@ -13,16 +13,18 @@ import org.reactivestreams.Subscription; @Path("/test") -@Produces("text/plain") public class MPSseConsumerResource { + private final static URI BASE_URI = URI.create("http://localhost:9080/ch4/rest"); + @GET @Path("/sse") + @Produces("text/plain") public CompletionStage getCombinedSseString() { CompletableFuture stage = new CompletableFuture<>(); StringBuilder sb = new StringBuilder(); SseClient client = RestClientBuilder.newBuilder() - .baseUri(URI.create("http://localhost:9080/ch4/rest")) + .baseUri(BASE_URI) .build(SseClient.class); client.receiveSSEs().subscribe(new Subscriber() { 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..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 @@ -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; @@ -26,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 @@ -44,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); } } 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 06d6e8b..c3f6e19 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 @@ -26,6 +26,8 @@ public class MPRestClient { @GET @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); @@ -42,15 +44,21 @@ 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) + // .register(NoSuchWordResponseMapper.class) .build(ThesaurusAsyncClient.class); + Arrays.stream(wordsArr).parallel() .map(thesaurus::getSynonymsFor) .forEach(cs -> { @@ -73,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 e8e9c15..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,39 +1,41 @@ package com.packt.microprofile.book.ch4.client; -import java.util.concurrent.CompletionStage; +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; -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; +// 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("/thesaurus/{word}") +@Path("/{word}") @RegisterProvider(NoSuchWordResponseMapper.class) -@Consumes(MediaType.TEXT_PLAIN) -@Produces(MediaType.TEXT_PLAIN) 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 05f5c56..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 @@ -1,46 +1,44 @@ 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; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; + @Path("/{word}") @RegisterProvider(NoSuchWordResponseMapper.class) @RegisterRestClient(baseUri = "http://localhost:9080/ch4/rest/thesaurus") -@Consumes(MediaType.TEXT_PLAIN) -@Produces(MediaType.TEXT_PLAIN) 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..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 @@ -29,40 +29,95 @@ public class ThesaurusResource { @GET public 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); } @POST public 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); } @PUT public 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); } @DELETE public boolean delete() throws NoSuchWordException { - if (null == map.remove(word)) + 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; } @PATCH public 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/liberty/config/server.xml b/Chapter04/src/main/liberty/config/server.xml index dc5dc9a..a37f9f7 100644 --- a/Chapter04/src/main/liberty/config/server.xml +++ b/Chapter04/src/main/liberty/config/server.xml @@ -9,6 +9,7 @@ diff --git a/Chapter04/src/main/resources/META-INF/microprofile-config.properties b/Chapter04/src/main/resources/META-INF/microprofile-config.properties index 8b13789..e69de29 100644 --- a/Chapter04/src/main/resources/META-INF/microprofile-config.properties +++ b/Chapter04/src/main/resources/META-INF/microprofile-config.properties @@ -1 +0,0 @@ - diff --git a/Chapter06/.gitignore b/Chapter06/.gitignore index 8ca4c1a..eaeeb3b 100644 --- a/Chapter06/.gitignore +++ b/Chapter06/.gitignore @@ -25,3 +25,5 @@ hs_err_pid* .project .settings/* /target/ +*.iml +.idea/* 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