Book Image

RESTful Java Web Services, Second Edition

Book Image

RESTful Java Web Services, Second Edition

Overview of this book

Table of Contents (17 chapters)
RESTful Java Web Services Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the JAX-RS resource lifecycle


Before winding up this chapter, let's take a quick look at the lifecycle of the JAX-RS components on the server when a client makes a RESTful web API call. This discussion would be a good summary of the topics that we learned so far on JAX-RS.

The following diagram depicts the sequence of actions taking place on the server when a client invokes the JAX-RS RESTful web service:

Here are the steps:

  1. For an incoming REST API call, the container identifies the Java servlet configured for handling the REST API calls by parsing the URI and then delegates the request to the designated servlet.

  2. The servlet initializes the JAX-RS runtime and kicks off the RESTful web service request processing cycle for the REST API call.

  3. The JAX-RS runtime processes the filters and interceptors configured in the application in the following sequence:

    1. Runtime executes prematching filters (ContainerRequestFilter with the @Prematching annotation), which happens before resolving the...