Skip to content

Commit

Permalink
[WFLY-19804] replaces JAX-RS references with Jakarta REST
Browse files Browse the repository at this point in the history
  • Loading branch information
emmartins committed Nov 4, 2024
1 parent 438aec8 commit eabcdf3
Show file tree
Hide file tree
Showing 34 changed files with 94 additions and 94 deletions.
10 changes: 5 additions & 5 deletions README-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ NOTE: Some of these quickstarts use the H2 database included with {productNameFu
| 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_
| 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_
| link:http-custom-mechanism/README{outfilesuffix}[http-custom-mechanism]|EJB, Security | No | The `http-custom-mechanism` quickstart demonstrates how to implement a custom HTTP authentication mechanism that can be registered with Elytron. | Intermediate | _none_
| link:jaxrs-client/README{outfilesuffix}[jaxrs-client]|JAX-RS | Yes | The `jaxrs-client` quickstart demonstrates Jakarta REST Client API, which interacts with a Jakarta REST Web service that runs on {productName}. | Beginner | _none_
| link:jaxrs-jwt/README{outfilesuffix}[jaxrs-jwt]|JAX-RS, Security | Yes | The `jaxrs-jwt` quickstart demonstrates a Jakarta REST secured application using JSON Web Tokens (JWT) with Elytron. | Intermediate | _none_
| link:jaxrs-client/README{outfilesuffix}[jaxrs-client]|Jakarta REST | Yes | The `jaxrs-client` quickstart demonstrates Jakarta REST Client API, which interacts with a Jakarta REST Web service that runs on {productName}. | Beginner | _none_
| link:jaxrs-jwt/README{outfilesuffix}[jaxrs-jwt]|Jakarta REST, Security | Yes | The `jaxrs-jwt` quickstart demonstrates a Jakarta REST secured application using JSON Web Tokens (JWT) with Elytron. | Intermediate | _none_
| link:jaxws-ejb/README{outfilesuffix}[jaxws-ejb]|JAX-WS | Yes | The `jaxws-ejb` quickstart is a working example of the web service endpoint created from an EJB. | Beginner | _none_
| link:jaxws-retail/README{outfilesuffix}[jaxws-retail]|JAX-WS | Yes | The `jaxws-retail` quickstart is a working example of a simple web service endpoint. | Beginner | _none_
| link:jsonp/README{outfilesuffix}[jsonp]|CDI, JSF, JSON-P | Yes | The `jsonp` quickstart demonstrates how to use the JSON-P API to produce object-based structures and then parse and consume them as stream-based JSON strings. | Beginner | _none_
| link:jta-crash-rec/README{outfilesuffix}[jta-crash-rec]|JTA, Crash Recovery | No | The `jta-crash-rec` quickstart uses JTA and Byteman to show how to code distributed (XA) transactions in order to preserve ACID properties on server crash. | Advanced | _none_
| link:jts/README{outfilesuffix}[jts]|JTS, EJB, JMS | No | The `jts` quickstart shows how to use JTS to perform distributed transactions across multiple containers, fulfilling the properties of an ACID transaction. | Intermediate | link:cmt/README.html[cmt]
| link:kitchensink/README{outfilesuffix}[kitchensink]|CDI, JSF, JPA, EJB, JAX-RS, BV | Yes | The `kitchensink` quickstart demonstrates a localized {javaVersion} web-enabled database application using JSF, CDI, EJB, JPA, and Bean Validation. | Intermediate | _none_
| link:kitchensink/README{outfilesuffix}[kitchensink]|CDI, JSF, JPA, EJB, Jakarta REST, BV | Yes | The `kitchensink` quickstart demonstrates a localized {javaVersion} web-enabled database application using JSF, CDI, EJB, JPA, and Bean Validation. | Intermediate | _none_
| link:logging/README{outfilesuffix}[logging]|Logging | Yes | The `logging` quickstart demonstrates how to configure different logging levels in {productName}. | Intermediate | _none_
| link:mail/README{outfilesuffix}[mail]|JavaMail, CDI, JSF | No | The `mail` quickstart demonstrates how to send and receive emails using CDI and JSF and with custom Mail provider configured in {productName}. | Beginner | _none_
| link:messaging-clustering-singleton/README{outfilesuffix}[messaging-clustering-singleton]|JMS, MDB, Clustering | No | The `messaging-clustering-singleton` quickstart uses a JMS topic and a queue to demonstrate clustering using {productName} messaging with MDB singleton configuration where only one node in the cluster will be active. | Advanced | _none_
Expand All @@ -171,8 +171,8 @@ NOTE: Some of these quickstarts use the H2 database included with {productNameFu
| link:spring-resteasy/README{outfilesuffix}[spring-resteasy]|Resteasy, Spring | Yes | The `spring-resteasy` quickstart demonstrates how to package and deploy a web application that includes resteasy-spring integration. | Beginner | _none_
| link:tasks-jsf/README{outfilesuffix}[tasks-jsf]|JSF, JPA | Yes | The `tasks-jsf` quickstart demonstrates how to use JPA persistence with JSF as the view layer. | Intermediate | _none_
| link:temperature-converter/README{outfilesuffix}[temperature-converter]|CDI, JSF, SLSB EJB | Yes | The `temperature-converter` quickstart does temperature conversion using an EJB Stateless Session Bean (SLSB), CDI, and a JSF front-end client. | Beginner | _none_
| link:thread-racing/README{outfilesuffix}[thread-racing]|Batch, CDI, EE Concurrency, JAX-RS, JMS, JPA, JSON, Web Sockets | Yes | A thread racing web application that demonstrates technologies introduced or updated in the latest Jakarta EE specification. | Beginner | _none_
| link:todo-backend/README{outfilesuffix}[todo-backend]|JPA, JAX-RS, OpenShift, Galleon | Yes | The `todo-backend` quickstart demonstrates how to implement a backend that exposes a HTTP API with JAX-RS | Intermediate | _none_
| link:thread-racing/README{outfilesuffix}[thread-racing]|Batch, CDI, EE Concurrency, Jakarta REST, JMS, JPA, JSON, Web Sockets | Yes | A thread racing web application that demonstrates technologies introduced or updated in the latest Jakarta EE specification. | Beginner | _none_
| link:todo-backend/README{outfilesuffix}[todo-backend]|JPA, Jakarta REST, OpenShift, Galleon | Yes | The `todo-backend` quickstart demonstrates how to implement a backend that exposes a HTTP API with Jakarta REST | Intermediate | _none_
| link:websocket-endpoint/README{outfilesuffix}[websocket-endpoint]|CDI, WebSocket, JSON-P | Yes | Shows how to use WebSockets with JSON to broadcast information to all open WebSocket sessions in {productName}. | Beginner | _none_
| link:websocket-hello/README{outfilesuffix}[websocket-hello]|WebSocket, CDI, JSF | Yes | The `websocket-hello` quickstart demonstrates how to create a simple WebSocket application. | Beginner | _none_
|===
Expand Down
2 changes: 1 addition & 1 deletion batch-processing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<scope>provided</scope>
</dependency>

<!-- Import the JAX-RS API, we use provided scope as the API is included
<!-- Import the Jakarta REST API, we use provided scope as the API is included
in JBoss EAP -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand Down
2 changes: 1 addition & 1 deletion ejb-throws-exception/web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<scope>provided</scope>
</dependency>

<!-- Import the JAX-RS API, we use provided scope as the API is included
<!-- Import the Jakarta REST API, we use provided scope as the API is included
in JBoss EAP -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand Down
2 changes: 1 addition & 1 deletion ejb-txn-remote-call/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the WS/JAX-RS -->
<!-- Import the WS/Jakarta REST -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import jakarta.xml.bind.annotation.XmlRootElement;

/**
* Hibernate entity and JSON element to be returned from a JAX-RS method.
* Hibernate entity and JSON element to be returned from a Jakarta REST method.
*/
@Entity
@XmlRootElement
Expand Down
2 changes: 1 addition & 1 deletion ejb-txn-remote-call/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
</dependencyManagement>

<dependencies>
<!-- Import the WS/JAX-RS -->
<!-- Import the WS/Jakarta REST -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
Expand Down
26 changes: 13 additions & 13 deletions guide/KitchensinkQuickstart.asciidoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CDI + JSF + EJB + JTA + Bean Validation + JAX-RS : Kitchensink quickstart
CDI + JSF + EJB + JTA + Bean Validation + Jakarta REST : Kitchensink quickstart
=====================================================================================
:Author: Pete Muir

Expand All @@ -17,9 +17,9 @@ feedback to users.
========================================================================

[TIP]
.JAX-RS: The Java API for RESTful Web Services
.Jakarta REST: The Java API for RESTful Web Services
========================================================================
JAX-RS is a specification in Jakarta EE. It allows application
Jakarta REST is a specification in Jakarta EE. It allows application
developers to easily expose Java services as RESTful web services.
========================================================================

Expand Down Expand Up @@ -67,7 +67,7 @@ image:gfx/Eclipse_KitchenSink_Deploy_3.jpg[]
The kitchensink quickstart in depth
-----------------------------------

The kitchensink application shows off a number of Jakarta EE technologies such as CDI, JSF, EJB, JTA, JAX-RS. It does this by providing a member registration database, available via JSF and JAX-RS.
The kitchensink application shows off a number of Jakarta EE technologies such as CDI, JSF, EJB, JTA, Jakarta REST. It does this by providing a member registration database, available via JSF and Jakarta REST.

As usual, let's start by looking at the necessary deployment descriptors. By now, we're very used to seeing `beans.xml` and `faces-config.xml` in `WEB-INF/` (which can be found in the `src/main/webapp` directory). Notice that, once again, we don't need a `web.xml`. There are two configuration files in `WEB-INF/classes/META-INF` (which can be found in the `src/main/resources` directory) — `persistence.xml`, which sets up JPA, and `import.sql` which Hibernate, the JPA provider in JBoss WildFly, will use to load the initial users into the application when the application starts. We discussed both of these files in detail in <<GreeterQuickstart-,the Greeter Quickstart>>, and these are largely the same.

Expand Down Expand Up @@ -295,7 +295,7 @@ public class Member implements Serializable {
}
------------------------------------------------------------------------
<1> As usual with JPA, we define that the class is an entity by adding @Entity
<2> Members are exposed as a RESTful service using JAX-RS. We can use JAXB to map the object to XML and to do this we need to add @XmlRootElement
<2> Members are exposed as a RESTful service using Jakarta REST. We can use JAXB to map the object to XML and to do this we need to add @XmlRootElement
<3> Bean Validation allows constraints to be defined once (on the entity) and applied everywhere. Here we constrain the person's name to a certain size and regular expression
<4> Hibernate Validator also offers some extra validations such as @Email
<5> @Digits , @NotNull and @Size are further examples of constraints
Expand Down Expand Up @@ -509,7 +509,7 @@ public class MemberController {
<7> We also send a message to the user, to give them feedback on their actions
<8> Finally, we replace the `newMember` with a new object, thus blanking out the data the user has added so far. This works as the producer field is dependent scoped

Before we wrap up our tour of the kitchensink application, let's take a look at how the JAX-RS endpoints are created. Firstly, `JaxRSActivator`, which extends `Application` and is annotated with `@ApplicationPath`, is the Jakarta EE "no XML" approach to activating JAX-RS.
Before we wrap up our tour of the kitchensink application, let's take a look at how the Jakarta REST endpoints are created. Firstly, `JaxRSActivator`, which extends `Application` and is annotated with `@ApplicationPath`, is the Jakarta EE "no XML" approach to activating Jakarta REST.

.src/main/java/org/jboss/as/quickstarts/kitchensink/rest/JaxRsActivator.java
[source,java]
Expand Down Expand Up @@ -561,7 +561,7 @@ public class MemberResourceRESTService {
/**
* Creates a new member from the values provided. Performs
* validation, and will return a JAX-RS response with either
* validation, and will return a Jakarta REST response with either
* 200 ok, or with a map of fields, and related errors.
*/
@POST
Expand Down Expand Up @@ -641,13 +641,13 @@ public class MemberResourceRESTService {
}
/**
* Creates a JAX-RS "Bad Request" response including a map of
* Creates a Jakarta REST "Bad Request" response including a map of
* all violation fields, and their message. This can then be
* used by clients to show violations.
*
* @param violations A set of violations that needs to be
* reported
* @return JAX-RS response containing all violations
* @return Jakarta REST response containing all violations
*/
private Response.ResponseBuilder createViolationResponse
(Set<ConstraintViolation<?>> violations) {
Expand Down Expand Up @@ -687,13 +687,13 @@ public class MemberResourceRESTService {
}
}
------------------------------------------------------------------------
<1> The `@Path` annotation tells JAX-RS that this class provides a REST endpoint mapped to `rest/members` (concatenating the path from the activator with the path for this endpoint).
<2> The bean is request scoped, as JAX-RS interactions typically don't hold state between requests
<3> JAX-RS endpoints are CDI enabled, and can use CDI-style injection.
<1> The `@Path` annotation tells Jakarta REST that this class provides a REST endpoint mapped to `rest/members` (concatenating the path from the activator with the path for this endpoint).
<2> The bean is request scoped, as Jakarta REST interactions typically don't hold state between requests
<3> Jakarta REST endpoints are CDI enabled, and can use CDI-style injection.
<4> CDI allows us to inject a Bean Validation `Validator` instance, which is used to validate the POSTed member before it is persisted
<5> `MemberRegistration` is injected to allow us to alter the member database
<6> `MemberRepository` is injected to allow us to query the member database
<7> The `listAllMembers()` method is called when the raw endpoint is accessed and offers up a list of endpoints. Notice that the object is automatically marshalled to JSON by RESTEasy (the JAX-RS implementation included in JBoss WildFly).
<7> The `listAllMembers()` method is called when the raw endpoint is accessed and offers up a list of endpoints. Notice that the object is automatically marshalled to JSON by RESTEasy (the Jakarta REST implementation included in JBoss WildFly).
<8> The `lookupMemberById()` method is called when the endpoint is accessed with a member id parameter appended (for example `rest/members/1)`. Again, the object is automatically marshalled to JSON by RESTEasy.
<9> `createMember()` is called when a POST is performed on the URL. Once again, the object is automatically unmarshalled from JSON.
<10> In order to ensure that the member is valid, we call the `validateMember` method, which validates the object, and adds any constraint violations to the response. These can then be handled on the client side, and displayed to the user
Expand Down
2 changes: 1 addition & 1 deletion jaxrs-client/README-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include::../shared-doc/attributes.adoc[]
= jaxrs-client: Jakarta REST Client API example
:author: Rafael Benevides
:level: Beginner
:technologies: JAX-RS
:technologies: Jakarta REST
:openshift: true
:portedToGlow: true

Expand Down
2 changes: 1 addition & 1 deletion jaxrs-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<version>35.0.0.Beta1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Quickstart: jaxrs-client</name>
<description>A JAX-RS Client API project</description>
<description>A Jakarta REST Client API project</description>

<licenses>
<license>
Expand Down
2 changes: 1 addition & 1 deletion jaxrs-jwt/README-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include::../shared-doc/attributes.adoc[]
= jaxrs-jwt: Jakarta REST secured using JSON Web Tokens (JWTs)
:author: Martin Mazanek
:level: Intermediate
:technologies: JAX-RS, Security
:technologies: Jakarta REST, Security
:standalone-server-type: default
:archiveType: war
:portedToGlow: true
Expand Down
2 changes: 1 addition & 1 deletion jsonp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<scope>provided</scope>
</dependency>

<!-- Import the JAX-RS API, we use provided scope as the API is included
<!-- Import the Jakarta REST API, we use provided scope as the API is included
in JBoss EAP -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand Down
4 changes: 2 additions & 2 deletions kitchensink/README-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include::../shared-doc/attributes.adoc[]
= kitchensink: Assortment of technologies
:author: Pete Muir
:level: Intermediate
:technologies: CDI, JSF, JPA, EJB, JAX-RS, BV
:technologies: CDI, JSF, JPA, EJB, Jakarta REST, BV
:openshift: true
:portedToGlow: true

Expand All @@ -19,7 +19,7 @@ The `kitchensink` quickstart demonstrates a localized {javaVersion} web-enabled

The `kitchensink` quickstart is a deployable Maven 3 project designed to help you get your foot in the door developing with {javaVersion} on {productNameFull}.

It demonstrates how to create a _localized_ {javaVersion} compliant application using JSF, CDI, JAX-RS, EJB, JPA, and Bean Validation. A localized application is one that supports multiple languages. It also includes a persistence unit and some sample persistence and transaction code to introduce you to database access in enterprise Java.
It demonstrates how to create a _localized_ {javaVersion} compliant application using JSF, CDI, Jakarta REST, EJB, JPA, and Bean Validation. A localized application is one that supports multiple languages. It also includes a persistence unit and some sample persistence and transaction code to introduce you to database access in enterprise Java.

This quickstart has been enhanced to provide localization of labels and messages. A user sets the preferred language choice in the browser and, if the application supports that language, the application web page is rendered in that language. For demonstration purposes, this quickstart has been tranlated into French(fr) and Spanish (es) using http://translate.google.com, so the translations may not be ideal.

Expand Down
2 changes: 1 addition & 1 deletion kitchensink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
<scope>provided</scope>
</dependency>

<!-- Import the JAX-RS API, we use provided scope as the API is included
<!-- Import the Jakarta REST API, we use provided scope as the API is included
in JBoss EAP -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* A class extending {@link Application} and annotated with @ApplicationPath is the Jakarta EE "no XML" approach to activating
* JAX-RS.
* Jakarta REST.
* <p>
* <p>
* Resources are served relative to the servlet path specified in the {@link ApplicationPath} annotation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import org.jboss.as.quickstarts.kitchensink.service.MemberRegistration;

/**
* JAX-RS Example
* Jakarta REST Example
* <p/>
* This class produces a RESTful service to read/write the contents of the members table.
*/
Expand Down Expand Up @@ -83,7 +83,7 @@ public Member lookupMemberById(@PathParam("id") long id) {
}

/**
* Creates a new member from the values provided. Performs validation, and will return a JAX-RS response with either 200 ok,
* Creates a new member from the values provided. Performs validation, and will return a Jakarta REST response with either 200 ok,
* or with a map of fields, and related errors.
*/
@POST
Expand Down Expand Up @@ -148,11 +148,11 @@ private void validateMember(Member member) throws ConstraintViolationException,
}

/**
* Creates a JAX-RS "Bad Request" response including a map of all violation fields, and their message. This can then be used
* Creates a Jakarta REST "Bad Request" response including a map of all violation fields, and their message. This can then be used
* by clients to show violations.
*
* @param violations A set of violations that needs to be reported
* @return JAX-RS response containing all violations
* @return Jakarta REST response containing all violations
*/
private Response.ResponseBuilder createViolationResponse(Set<ConstraintViolation<?>> violations) {
log.fine("Validation completed. violations found: " + violations.size());
Expand Down
Loading

0 comments on commit eabcdf3

Please sign in to comment.