Developing a RESTful service with JAX-RS
In this section, we will develop a few RESTful services using JAX-RS. We'll start with a simple example, and then we'll add more complex and powerful techniques such as exception handling, advanced conversion of HyperText Transfer Protocol (HTTP) data into Java objects (and vice versa), cross-cutting concerns, asynchronous methods, and DI.
JAX-RS is built around the idea of a request-response pipeline. On the server side, an HTTP request enters the pipeline, then the JAX-RS server invokes any pre-matching filters on the request. It then attempts to match the request with a JAX-RS resource method. Â
When the JAX-RS container receives an incoming request, it will perform the following process:
- Invoke any registered pre-matching filters.
- Attempt to match the request to a
resource
method. If no match can be made, the container will respond with an appropriatenot found
HTTP response. - Invoke any registered...