In this section, we're going to take a look at how to implement simple sub-resource locator methods. We'll have a look at how you can obtain CDI sub-resource instances from the root resource, and we're going to have a look at how you can pass context information from the root to the sub-resources:
Books have authors, and they can be lent out. In this section, what we'll do is provide specific REST endpoints to obtain the author of a book and the loan details of the books. We have prepared the skeleton of the project, as shown in the following screenshot:
Let's start with the authors. In BookResource.java, add a resource locator method. A resource locator method is a simple method that is only annotated using the @Path annotation. In this case, we use @Path("/{isbn}/author"). The return type...