From 0f603e12ccb39077ec866c02564a471b7ff651a5 Mon Sep 17 00:00:00 2001 From: sudeshnas93 Date: Tue, 18 Jun 2024 19:41:05 +0530 Subject: [PATCH] [WFLY-19435] microprofile-reactive-messaging-kafka Quickstarts should have a root webpage similar to helloworld --- .../README.adoc | 12 ++++----- .../reactive/messaging/JaxRsApplication.java | 2 +- .../src/main/webapp/index.html | 27 +++++++++++++++++++ .../reactive/messaging/test/TestUtils.java | 3 ++- 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 microprofile-reactive-messaging-kafka/src/main/webapp/index.html diff --git a/microprofile-reactive-messaging-kafka/README.adoc b/microprofile-reactive-messaging-kafka/README.adoc index 3805794b66..cc1f3500d9 100644 --- a/microprofile-reactive-messaging-kafka/README.adoc +++ b/microprofile-reactive-messaging-kafka/README.adoc @@ -1290,7 +1290,7 @@ package org.wildfly.quickstarts.microprofile.reactive.messaging; import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; -@ApplicationPath("/") +@ApplicationPath("/rest") public class JaxRsApplication extends Application { } @@ -1525,7 +1525,7 @@ Then we get another section where it is using the randomised order In both parts of the log we see that all messages reach the `logAllMessages()` method, while only `Hello` and `Kafka` reach the `receiveFromKafka()` method which saves them to the RDBMS. -To inspect what was stored in the database, go to http://localhost:8080/microprofile-reactive-messaging-kafka/db in your browser and you should see something like: +To inspect what was stored in the database, go to http://localhost:8080/microprofile-reactive-messaging-kafka/rest/db in your browser and you should see something like: [source, options="nowrap"] ---- @@ -1539,15 +1539,15 @@ The timestamps of the entries in the browser match the ones we saw in the server === Interaction with User Initiated Code With the application still running, open two terminal windows. Enter the following `curl` command in both of them ``` -$curl -N http://localhost:8080/microprofile-reactive-messaging-kafka/user +$curl -N http://localhost:8080/microprofile-reactive-messaging-kafka/rest/user ``` The `-N` option keeps the connection open, so we receive data as it becomes available on the publisher. In a third terminal window enter the commands: ``` -$curl -X POST http://localhost:8080/microprofile-reactive-messaging-kafka/user/one -$curl -X POST http://localhost:8080/microprofile-reactive-messaging-kafka/user/two -$curl -X POST http://localhost:8080/microprofile-reactive-messaging-kafka/user/three +$curl -X POST http://localhost:8080/microprofile-reactive-messaging-kafka/rest/user/one +$curl -X POST http://localhost:8080/microprofile-reactive-messaging-kafka/rest/user/two +$curl -X POST http://localhost:8080/microprofile-reactive-messaging-kafka/rest/user/three ``` In the first two terminal windows you should see these entries appear as they are posted: ``` diff --git a/microprofile-reactive-messaging-kafka/src/main/java/org/wildfly/quickstarts/microprofile/reactive/messaging/JaxRsApplication.java b/microprofile-reactive-messaging-kafka/src/main/java/org/wildfly/quickstarts/microprofile/reactive/messaging/JaxRsApplication.java index 3b9241f0be..71a60936fd 100644 --- a/microprofile-reactive-messaging-kafka/src/main/java/org/wildfly/quickstarts/microprofile/reactive/messaging/JaxRsApplication.java +++ b/microprofile-reactive-messaging-kafka/src/main/java/org/wildfly/quickstarts/microprofile/reactive/messaging/JaxRsApplication.java @@ -19,6 +19,6 @@ import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; -@ApplicationPath("/") +@ApplicationPath("/rest") public class JaxRsApplication extends Application { } diff --git a/microprofile-reactive-messaging-kafka/src/main/webapp/index.html b/microprofile-reactive-messaging-kafka/src/main/webapp/index.html new file mode 100644 index 0000000000..014accab59 --- /dev/null +++ b/microprofile-reactive-messaging-kafka/src/main/webapp/index.html @@ -0,0 +1,27 @@ + + + +microprofile-reactive-messaging-kafka + +
+ +

Hello There! Welcome to WildFly!

+

The microprofile-reactive-messaging-kafka quickstart application has been deployed and running successfully.

+ +
+ + \ No newline at end of file diff --git a/microprofile-reactive-messaging-kafka/src/test/java/org/wildfly/quickstarts/microprofile/reactive/messaging/test/TestUtils.java b/microprofile-reactive-messaging-kafka/src/test/java/org/wildfly/quickstarts/microprofile/reactive/messaging/test/TestUtils.java index 483a7cda51..01ec086b37 100644 --- a/microprofile-reactive-messaging-kafka/src/test/java/org/wildfly/quickstarts/microprofile/reactive/messaging/test/TestUtils.java +++ b/microprofile-reactive-messaging-kafka/src/test/java/org/wildfly/quickstarts/microprofile/reactive/messaging/test/TestUtils.java @@ -2,6 +2,7 @@ public class TestUtils { static final String DEFAULT_SERVER_HOST = "http://localhost:8080/microprofile-reactive-messaging-kafka"; + static final String API_PATH = "/rest"; static String getServerHost() { String serverHost = System.getenv("SERVER_HOST"); @@ -11,6 +12,6 @@ static String getServerHost() { if (serverHost == null) { serverHost = DEFAULT_SERVER_HOST; } - return serverHost; + return serverHost + API_PATH; } }