Skip to content

Commit fc31602

Browse files
committed
[WFLY-19618] Helloworld REST Quickstart
Issue: https://issues.redhat.com/browse/WFLY-19618
1 parent f5d53f4 commit fc31602

File tree

10 files changed

+401
-1
lines changed

10 files changed

+401
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: WildFly helloworld-rs Quickstart CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths:
7+
- 'helloworld-rs/**'
8+
- '.github/workflows/quickstart_ci.yml'
9+
jobs:
10+
call-quickstart_ci:
11+
uses: ./.github/workflows/quickstart_ci.yml
12+
with:
13+
QUICKSTART_PATH: helloworld-rs
14+
TEST_PROVISIONED_SERVER: true

README-source.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ NOTE: Some of these quickstarts use the H2 database included with {productNameFu
136136
| link:helloworld-mdb/README{outfilesuffix}[helloworld-mdb]|JMS, EJB, MDB | Yes | The `helloworld-mdb` quickstart uses JMS and EJB Message-Driven Bean (MDB) to create and deploy JMS topic and queue resources in {productName}. | Intermediate | _none_
137137
| link:helloworld-mutual-ssl/README{outfilesuffix}[helloworld-mutual-ssl]|Mutual TLS, Undertow | No | The `helloworld-mutual-ssl` quickstart is a basic example that demonstrates mutual TLS configuration in {productName} | Intermediate | _none_
138138
| link:helloworld-mutual-ssl-secured/README{outfilesuffix}[helloworld-mutual-ssl-secured]|Mutual TLS, Security, Undertow | No | The `helloworld-mutual-ssl-secured` quickstart demonstrates securing a Web application using client certificate authentication with authorization | Intermediate | _none_
139+
| link:helloworld-rs/README{outfilesuffix}[helloworld-rs]|Jakarta RESTful Web Services | No | The `helloworld-rs` quickstart demonstrates the use of Jakarta RESTful Web Services. | Begginer | _none_
139140
| link:helloworld-singleton/README{outfilesuffix}[helloworld-singleton]|EJB, Singleton | Yes | The `helloworld-singleton` quickstart demonstrates an EJB Singleton Bean that is instantiated once and maintains state for the life of the session. | Beginner | _none_
140141
| link:helloworld-ws/README{outfilesuffix}[helloworld-ws]|JAX-WS | Yes | The `helloworld-ws` quickstart demonstrates a simple Hello World application, bundled and deployed as a WAR, that uses JAX-WS to say Hello. | Beginner | _none_
141142
| link:hibernate/README{outfilesuffix}[hibernate]|Hibernate | Yes | The `hibernate` quickstart demonstrates how to use Hibernate ORM 6 over Persistence, using Bean Validation, and Enterprise Beans. | Intermediate | _none_

helloworld-rs/README-source.adoc

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
include::../shared-doc/attributes.adoc[]
2+
3+
= helloworld-rs: Jakarta RESTful Web Services Helloworld Example
4+
:author: Ashwin Mehendale
5+
:level: Beginner
6+
:technologies: Jakarta RESTful Web Services
7+
:openshift: true
8+
:portedToGlow: true
9+
10+
[abstract]
11+
The `helloworld-rs` quickstart demonstrates the use of Jakarta RESTful Web Services.
12+
13+
:standalone-server-type: default
14+
:archiveType: war
15+
16+
== What is it?
17+
18+
The `helloworld-rs` quickstart demonstrates the use of _Jakarta RESTful Web Services_ in {productNameFull} {productVersion}.
19+
20+
// Link to the quickstart source
21+
include::../shared-doc/view-the-source.adoc[leveloffset=+1]
22+
// System Requirements
23+
include::../shared-doc/system-requirements.adoc[leveloffset=+1]
24+
// Use of {jbossHomeName}
25+
include::../shared-doc/use-of-jboss-home-name.adoc[leveloffset=+1]
26+
27+
// build and run with standard server distribution
28+
[[build_and_run_the_quickstart_with_server_dist]]
29+
== Building and running the quickstart application with a {productName} server distribution
30+
// Start the {productName} Standalone Server
31+
include::../shared-doc/start-the-standalone-server.adoc[leveloffset=+2]
32+
// Build and Deploy the Quickstart
33+
include::../shared-doc/build-and-deploy-the-quickstart.adoc[leveloffset=+2]
34+
35+
=== Access the Application
36+
The application will be running at the following URL: http://localhost:8080/{artifactId}/.
37+
38+
// Server Distribution Testing
39+
include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+2]
40+
// Undeploy the Quickstart
41+
include::../shared-doc/undeploy-the-quickstart.adoc[leveloffset=+2]
42+
43+
// Build and run sections for other environments/builds
44+
ifndef::ProductRelease,EAPXPRelease[]
45+
include::../shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc[leveloffset=+1]
46+
endif::[]
47+
include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]
48+
ifndef::ProductRelease,EAPXPRelease[]
49+
//Kubernetes
50+
include::../shared-doc/build-and-run-the-quickstart-with-kubernetes.adoc[leveloffset=+1]
51+
endif::[]

helloworld-rs/charts/helm.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build:
2+
uri: https://github.com/wildfly/quickstart.git
3+
ref: main
4+
contextDir: helloworld-rs
5+
deploy:
6+
replicas: 1

helloworld-rs/pom.xml

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!--
3+
Copyright The WildFly Authors
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
8+
<modelVersion>4.0.0</modelVersion>
9+
<parent>
10+
<groupId>org.wildfly.quickstarts</groupId>
11+
<artifactId>wildfly-quickstart-parent</artifactId>
12+
<!--
13+
Maintain separation between the artifact id and the version to help prevent
14+
merge conflicts between commits changing the GA and those changing the V.
15+
-->
16+
<version>8</version>
17+
<relativePath/>
18+
</parent>
19+
<artifactId>helloworld-rs</artifactId>
20+
<version>35.0.0.Beta1-SNAPSHOT</version>
21+
<packaging>war</packaging>
22+
<name>Quickstart: helloworld-rs</name>
23+
<description>A simple Hello World project that uses Jakarta RESTful Web Services</description>
24+
25+
<licenses>
26+
<license>
27+
<name>Apache License, Version 2.0</name>
28+
<distribution>repo</distribution>
29+
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
30+
</license>
31+
</licenses>
32+
33+
<properties>
34+
<!-- the version for the Server -->
35+
<version.server>34.0.0.Final</version.server>
36+
<!-- the versions for BOMs, Packs and Plugins -->
37+
<version.bom.ee>${version.server}</version.bom.ee>
38+
<version.plugin.wildfly>5.0.0.Final</version.plugin.wildfly>
39+
</properties>
40+
41+
<dependencyManagement>
42+
<dependencies>
43+
<!-- importing the ee-with-tools BOM adds specs and other useful artifacts as managed dependencies -->
44+
<dependency>
45+
<groupId>org.wildfly.bom</groupId>
46+
<artifactId>wildfly-ee-with-tools</artifactId>
47+
<version>${version.bom.ee}</version>
48+
<type>pom</type>
49+
<scope>import</scope>
50+
</dependency>
51+
</dependencies>
52+
</dependencyManagement>
53+
54+
<dependencies>
55+
<!-- Import the Jakarta REST API, we use provided scope as the API is included in the server -->
56+
<dependency>
57+
<groupId>jakarta.ws.rs</groupId>
58+
<artifactId>jakarta.ws.rs-api</artifactId>
59+
<scope>provided</scope>
60+
</dependency>
61+
62+
<!-- Tests -->
63+
<dependency>
64+
<groupId>junit</groupId>
65+
<artifactId>junit</artifactId>
66+
<scope>test</scope>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.jboss.resteasy</groupId>
70+
<artifactId>resteasy-client</artifactId>
71+
<scope>test</scope>
72+
</dependency>
73+
<!-- resteasy client needs commons-logging yet the server uses this instead,
74+
to be fully compatible on apps we need to add this dependency whenever commons-logging is needed,
75+
but on testing clients like this we could use commons-logging instead -->
76+
<dependency>
77+
<groupId>org.jboss.logging</groupId>
78+
<artifactId>commons-logging-jboss-logging</artifactId>
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.jboss.resteasy</groupId>
83+
<artifactId>resteasy-json-p-provider</artifactId>
84+
<scope>test</scope>
85+
</dependency>
86+
<!-- Required by the resteasy-json-p-provider -->
87+
<dependency>
88+
<groupId>org.eclipse.parsson</groupId>
89+
<artifactId>parsson</artifactId>
90+
<scope>test</scope>
91+
</dependency>
92+
</dependencies>
93+
94+
<build>
95+
<pluginManagement>
96+
<plugins>
97+
<plugin>
98+
<groupId>org.wildfly.plugins</groupId>
99+
<artifactId>wildfly-maven-plugin</artifactId>
100+
<version>${version.plugin.wildfly}</version>
101+
</plugin>
102+
</plugins>
103+
</pluginManagement>
104+
</build>
105+
106+
<profiles>
107+
<profile>
108+
<id>provisioned-server</id>
109+
<build>
110+
<plugins>
111+
<plugin>
112+
<groupId>org.wildfly.plugins</groupId>
113+
<artifactId>wildfly-maven-plugin</artifactId>
114+
<configuration>
115+
<discover-provisioning-info>
116+
<version>${version.server}</version>
117+
</discover-provisioning-info>
118+
<!--
119+
Rename the output war to ROOT.war before adding it to the server, so that the
120+
application is deployed in the root web context.
121+
-->
122+
<name>ROOT.war</name>
123+
</configuration>
124+
<executions>
125+
<execution>
126+
<goals>
127+
<goal>package</goal>
128+
</goals>
129+
</execution>
130+
</executions>
131+
</plugin>
132+
</plugins>
133+
</build>
134+
</profile>
135+
<profile>
136+
<id>openshift</id>
137+
<build>
138+
<plugins>
139+
<plugin>
140+
<groupId>org.wildfly.plugins</groupId>
141+
<artifactId>wildfly-maven-plugin</artifactId>
142+
<configuration>
143+
<discover-provisioning-info>
144+
<version>${version.server}</version>
145+
<context>cloud</context>
146+
</discover-provisioning-info>
147+
<!--
148+
The parent POM's 'openshift' profile renames the output archive to ROOT.war so that the
149+
application is deployed in the root web context. Add ROOT.war to the server.
150+
-->
151+
<filename>ROOT.war</filename>
152+
</configuration>
153+
<executions>
154+
<execution>
155+
<goals>
156+
<goal>package</goal>
157+
</goals>
158+
</execution>
159+
</executions>
160+
</plugin>
161+
</plugins>
162+
</build>
163+
</profile>
164+
<profile>
165+
<id>integration-testing</id>
166+
<build>
167+
<plugins>
168+
<plugin>
169+
<groupId>org.apache.maven.plugins</groupId>
170+
<artifactId>maven-failsafe-plugin</artifactId>
171+
<configuration>
172+
<includes>
173+
<include>**/RESTEndPointIT</include>
174+
</includes>
175+
</configuration>
176+
<executions>
177+
<execution>
178+
<goals>
179+
<goal>integration-test</goal>
180+
<goal>verify</goal>
181+
</goals>
182+
</execution>
183+
</executions>
184+
</plugin>
185+
</plugins>
186+
</build>
187+
</profile>
188+
</profiles>
189+
190+
<repositories>
191+
<repository>
192+
<id>jboss-public-maven-repository</id>
193+
<name>JBoss Public Maven Repository</name>
194+
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
195+
<releases>
196+
<enabled>true</enabled>
197+
<updatePolicy>never</updatePolicy>
198+
</releases>
199+
<snapshots>
200+
<enabled>true</enabled>
201+
<updatePolicy>never</updatePolicy>
202+
</snapshots>
203+
<layout>default</layout>
204+
</repository>
205+
</repositories>
206+
<pluginRepositories>
207+
<pluginRepository>
208+
<id>jboss-public-maven-repository</id>
209+
<name>JBoss Public Maven Repository</name>
210+
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
211+
<releases>
212+
<enabled>true</enabled>
213+
</releases>
214+
<snapshots>
215+
<enabled>true</enabled>
216+
</snapshots>
217+
</pluginRepository>
218+
</pluginRepositories>
219+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright The WildFly Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
package org.jboss.as.quickstarts.rshelloworld;
6+
7+
import jakarta.ws.rs.GET;
8+
import jakarta.ws.rs.Path;
9+
import jakarta.ws.rs.Produces;
10+
import jakarta.ws.rs.core.MediaType;
11+
/**
12+
* A simple REST service which is able to say "Hello World!"
13+
*
14+
* @author Ashwin Mehendale
15+
* @author emartins
16+
*/
17+
18+
@Path("/")
19+
public class HelloWorld {
20+
21+
@GET
22+
@Path("/HelloWorld")
23+
@Produces(MediaType.TEXT_PLAIN)
24+
public String hello() {
25+
return "Hello World!";
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright The WildFly Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
package org.jboss.as.quickstarts.rshelloworld;
6+
7+
import jakarta.ws.rs.ApplicationPath;
8+
import jakarta.ws.rs.core.Application;
9+
10+
/**
11+
* JakartaRESTActivator is an arbitrary name, what is important is that jakarta.ws.rs.core.Application is extended
12+
* and the @ApplicationPath annotation is used with a "rest" path. Without this the rest endpoints linked to
13+
* from index.html would not be found.
14+
*/
15+
@ApplicationPath("rest")
16+
public class JakartaRESTActivator extends Application {
17+
// Left empty intentionally
18+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--
2+
Copyright The WildFly Authors
3+
SPDX-License-Identifier: Apache-2.0
4+
-->
5+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
6+
<html>
7+
<head>
8+
<meta http-equiv="Refresh" content="0; URL=rest/HelloWorld">
9+
</head>
10+
</html>

0 commit comments

Comments
 (0)