
Developing Middleware in Java EE 8
By :

In the following sections, we are going to create our first REST service. Creating a REST service in JAX-RS requires the following two steps:
A resource class is the primary building block of RESTful services in JAX-RS. It's a POJO that includes one or more resource methods. Each resource method represents a RESTful service that can be called using one of the main core HTTP methods (GET
, POST
, PUT
, or DELETE
).
In order to create a resource class, you will add the @Path
annotation to your POJO. The annotation is passed a relative URI that represents the URL of your RESTful service. You will introduce one or more method, annotated with one of the method designator annotations (@GET
,@POST
,@PUT
, or@DELETE
).
Let's see an example...