Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFLY-19427] microprofile-config Quickstarts should have a root webpage similar to helloworld #932

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions microprofile-config/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ package org.wildfly.quickstarts.microprofile.config;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

@ApplicationPath("/")
@ApplicationPath("/rest")
public class JaxRsApplication extends Application {
}
----
Expand Down Expand Up @@ -809,9 +809,9 @@ $ mvn clean package wildfly:deploy

To check that the {productName} is working as expected:

* access the `http://localhost:8080/microprofile-config/config/value`
* access the `http://localhost:8080/microprofile-config/rest/config/value`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/config/value`
`curl http://localhost:8080/microprofile-config/rest/config/value`

You will see that the returned value is our configured system property
`MyPropertyFileConfigValue`.
Expand All @@ -828,9 +828,9 @@ specification): `export CONFIG_PROP=MyEnvPropConfigValue`

* Start your {productName} server again

* access the `http://localhost:8080/microprofile-config/config/value`
* access the `http://localhost:8080/microprofile-config/rest/config/value`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/config/value`
`curl http://localhost:8080/microprofile-config/rest/config/value`

You can see that our configuration value defined in the configuration file was
now overridden by the environment property and the value `MyEnvPropConfigValue`
Expand All @@ -843,9 +843,9 @@ priority:

* Start your {productName} server with the `-Dconfig.prop=MySysPropConfigValue`

* access the `http://localhost:8080/microprofile-config/config/value`
* access the `http://localhost:8080/microprofile-config/rest/config/value`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/config/value`
`curl http://localhost:8080/microprofile-config/rest/config/value`

The configuration property was overriden again and the value `MySysPropConfigValue`
is returned.
Expand Down Expand Up @@ -919,9 +919,9 @@ $ mvn clean package wildfly:deploy
----

The application should now deploy without any errors and if access the
`http://localhost:8080/microprofile-config/config/required` endpoint
`http://localhost:8080/microprofile-config/rest/config/required` endpoint
using your browser or
`curl http://localhost:8080/microprofile-config/config/required` you
`curl http://localhost:8080/microprofile-config/rest/config/required` you
will see the default value that we configured in the `ConfigProperty` qualifier.

However, this is not the only way how you can deal with the situation when the
Expand Down Expand Up @@ -959,9 +959,9 @@ $ mvn clean package wildfly:deploy
----

If you now access the
`http://localhost:8080/microprofile-config/config/optional` endpoint
`http://localhost:8080/microprofile-config/rest/config/optional` endpoint
using your browser or
`curl http://localhost:8080/microprofile-config/config/optional` you
`curl http://localhost:8080/microprofile-config/rest/config/optional` you
will get back the `orElse` value because the `optional.prop` was not defined
in our config sources.

Expand Down Expand Up @@ -989,9 +989,9 @@ Build and redeploy the application
$ mvn clean package wildfly:deploy
----

Access the `http://localhost:8080/microprofile-config/config/all-props`
Access the `http://localhost:8080/microprofile-config/rest/config/all-props`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/config/all-props` and
`curl http://localhost:8080/microprofile-config/rest/config/all-props` and
you will see all available configuration property names.

NOTE: You can investigate also the other methods of the `Config` interface.
Expand Down Expand Up @@ -1099,9 +1099,9 @@ $ mvn clean package wildfly:deploy
----

If you now access the
`http://localhost:8080/microprofile-config/custom-config/value`
`http://localhost:8080/microprofile-config/rest/custom-config/value`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/custom-config/value`
`curl http://localhost:8080/microprofile-config/rest/custom-config/value`
you will get back the configuration value `MyCustomValue` defined in our custom
configuration source.

Expand Down Expand Up @@ -1229,14 +1229,14 @@ $ mvn clean package wildfly:deploy
----

If you now access the
`http://localhost:8080/microprofile-config/custom-config/reloaded-value`
`http://localhost:8080/microprofile-config/rest/custom-config/reloaded-value`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/custom-config/reloaded-value`
`curl http://localhost:8080/microprofile-config/rest/custom-config/reloaded-value`
you will get back the configuration value `FileSystemCustomConfigValue` defined
in our custom configuration file. But if you now change the `custom.properties`
file (without stopping of the server or the need to redeploy the application)
and repeat the invocation at
`http://localhost:8080/microprofile-config/custom-config/reloaded-value`
`http://localhost:8080/microprofile-config/rest/custom-config/reloaded-value`
you will see that the value is dynamically reloaded:

* change `$JBOSS_HOME/custom.properties` (don't forget to save the file):
Expand All @@ -1247,7 +1247,7 @@ custom.provided.prop=DynamicallyUpdatedValue
----

* repeat the invocation at
`http://localhost:8080/microprofile-config/custom-config/reloaded-value`
`http://localhost:8080/microprofile-config/rest/custom-config/reloaded-value`

You will see that the value `DynamicallyUpdatedValue` is returned. If you repeat
this with different values of `custom.provide.prop` it will always get reloaded.
Expand Down Expand Up @@ -1359,9 +1359,9 @@ $ mvn clean package wildfly:deploy
----

And now you can access the
`http://localhost:8080/microprofile-config/converter/value`
`http://localhost:8080/microprofile-config/rest/converter/value`
endpoint using your browser or
`curl http://localhost:8080/microprofile-config/converter/value` to make use of the custom
`curl http://localhost:8080/microprofile-config/rest/converter/value` to make use of the custom
converter. You will see the configured value which is taken from our created
`MicroProfileCustomValue` object.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

@ApplicationPath("/")
@ApplicationPath("/rest")
public class JaxRsApplication extends Application {
}
28 changes: 28 additions & 0 deletions microprofile-config/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
JBoss, Home of Professional Open Source
Copyright 2024, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<title>microprofile-config</title>
<body>
<div style="text-align:center">

<h1>Hello There! Welcome to WildFly!</h1>
<h2>The microprofile-config application has been deployed and running successfully.</h2>

</div>
</body>

</html>
Loading