RESTful with JEE8
Fast RESTful WS development with JEE8
@augustojimenez1
Augusto Alonso de Cruz Jimenez
Enero de 2019
"Make everything as simple as possible, but not simpler."
Albert Einstein
Augusto Alonso de Cruz Jimenez
@augustojimenez1
Agenda
- What is JEE
- The JEE's evolution
- JEE Specifications
- JEE Providers
- The JAX-RS specification
- Developing a simple JAX-RS application
- Running the app on an Application Server
- Serverless applications
- Embedded Application Server providers
- Running the app on an emmbeded app server
- Docker considerations
- Summary
What is Java
- Is a language
- Is a platform - JVM
- Is an API
There are many implementations of de JVM Platform
Azul Zulu
Bck2Brwsr
CACAO
Codename One
DoppioJVM
OpenJ9
GraalVM CE
HaikuVM
HotSpot
Jamiga
JamVM
Jelatine JVM.
Jikes RVM
JVM.go
JVM.go
leJOS
Maxine
Multi-OS Engine
RopeVM
uJVM
What is JEE
- Java Enterprise Edition
- Is a super set of specifications
- Distributed computing
- Web services
- Transactions
- Security
- Scalability
- Concurrency
- Management of the components' lifecycle
JEE 7+ is designed to use POJO to turn them into managed objects
The JEE's evolution
- J2EE
- JEE
- JakartaEE
There is an initiative called Microprofile, which is designed to align with microservices architecture style applications.
A recommended article about the JEE's evolution (and another topics) is Microprofile: Mucho camino para llegar aquí, by @rugy
The JEE's specs
Java EE 8 was approved by the JCP EC on Aug 21, 2017. The final specification is available for download on this link.
Java EE 8 has 35+ specs, including:
Servlet, JAX-WS, JAX-RS, JPA, JAXB, JSONP, WebSockets, JSF, EL, JSTL, Batch, CDI, Bean Validation, etc.
A condensed list of specifications can be found at oracle.com
The JEE's specs

JEE 8 providers
Java EE 8 is a spec
There are many providers (implementers)
The Expert Group validate the implementation.
Some Java EE8 certified Full implementations of the spec are:


The JAX-RS spec
Officially:
JSR 370: Java™ API for RESTful Web Services (JAX-RS 2.1) Specification
Implementations:
- Apache CXF
- Jersey
- RESTeasy
- Restlet
- Apache Wink
If an application server is fully compatible with JAX-RS, the same JAX-RS code is executed in any of them.
The JAX-RS spec
Provides some annotations to aid in mapping a resource class (a POJO) as a web resource. They include:
- @Path
- @GET, @PUT, @POST, @DELETE and @HEAD
- @Produces, @Consumes
- @PathParam, @QueryParam, @MatrixParam
- @HeaderParam
- @CookieParam
- @FormParam
- @Context
How a POJO annotated with JAX-RS looks like? It's time to code!!!
JAX-RS resource example
package com.example.book.restapi;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("books")
public class BookResource {
@GET
public String resourceInfo() {
return "Book information";
}
}
Fast RESTful WS development with JEE8
By Augusto Alonso de la Cruz Jimenez
Fast RESTful WS development with JEE8
- 77