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 subresources and subresource locators in JAX-RS


While discussing the JAX-RS APIs in the previous chapter, we covered the resource class and the resource class methods in RESTful web APIs. If you need a quick brush-up on this topic, refer to the Annotations for defining a RESTful resource section in Chapter 3, Introducing the JAX-RS API. In this section, you will get introduced to two new concepts, namely subresources and subresource locators in REST. You will find them very useful while designing well-structured RESTful web APIs.

Subresources in JAX-RS

In the previous chapter, we discussed about the @Path annotation that identifies the URI path that a resource class or class method will serve requests for. A class annotated with the @Path annotation (at the class level) is called the root resource class. You can also use the @Path annotation on the methods of the root resource classes. If a resource method with the @Path annotation is annotated with the request method designator...