Check the latest Jakarta EE REST Example project.
I have created a RESTful API sample to demostrate how to build RESTful APIs with Java EE 7 and JAX-RS 2.0.
In this sample, I will rewrite it with the latest Java EE 8. I will use Glassfish v5 as target runtime, because Java EE 8 supprt in other application servers are still under construction, as I know the newest Wildfly v11 still does not support Java EE 8, and IBM Open Liberty has began to add Java EE 8 features as its further rolling updates.
The following specifications are used in this sample appliacation:
- JAX-RS 2.1
- JSON-P 1.1 and JSON-B 1.0
- JPA 2.2(and EJB, JTA) for database operations
- CDI 2
- Bean Validation 2
- Java EE Security 1.0
You have to use a blog system, a CMS like publishing platform etc. In this sample, I will demonstrate how to create a simple blog application.
- backend is the RESTful APIs, stateless, protected by JWT authentication.
- frontend UI, a Angular SPA applicatoin(in plan)
In the initial version, it could includes the following features:
- CRUD operation for post resouces
- Comment on a certtain post
- User can favorite/unfavorite a certain post
I have also created some some variants to demonstrate varied technology stack in the past, you can browse which you are interested in.
- Build RESTful APIs with Spring MVC
- Build RESTful APIs with Spring MVC and Spring Boot, please read the online Gitbook for more details.
- Build RESTful APIs with Java EE 7 and JAX-RS, please check the wiki pages for the developer notes.
To try this appliacation in your local system, make sure you have already installed the following software.
- Oracle Java 8
- Apache Maven
- NetBeans IDE, NetBeans 9 nightly is recommended.
- Glassfish v5
Clone the source codes from github.
git clone https://github.com/hantsy/javaee8-jaxrs-sample
Or check out the codes NetBeans IDE which have great Git support.
Now you can run it from mvn command line or NetBeans IDE.
mvn verify cargo:run
- Adds Glassfish in Server node in the Service view.
- Open the project(if you used NetBeans to check out the codes, it could be open by default)
- Right click the project node, and select Run to run this project on Glassfish.
Welcome to contribute this project, you can fork it and send a pull request, or share your idea on Github issues.