RESTful Java with JAX-RS 2.0
In the age of APIs, it is more obvious than ever that significant part of business value of many organizations (or their products) stems from their exposed interfaces. One of the most popular architectural styles to design and build such an API is REST. RESTful web services were introduced to Java in JSR 311 and the specification got name JAX-RS. At the time of writing this review JAX-RS reached version 2.0 and 2.1 is being drafted. Realizing this I felt the need to brush up on my previous knowledge of this technology and see what it has to offer. In my search for study resources I came across an awesome book called RESTful Java with JAX-RS 2.0 by Bill Burke, software architect and developer from Red Hat with years of experience working with REST and related technologies.
The book itself is rather short and really enjoyable to read. The content is split into two parts. First part is concerned with description of REST and JAX-RS standard, while the second part is a workbook. The author slowly opens up the world of REST to the reader, while providing helpful design and code examples. Basic understanding of Java is required in order to be able to understand concepts described in this book. On the other hand, this allows the author to focus more on JAX-RS related stuff and not to waste your time describing other frameworks or language fundamentals. Explanation is always to the point and nicely comprehensible.
I really liked the way this book was written and the fact that author discusses several different approaches to achieve something and also provides his own opinion on what to use when and why. These opinions are usually backed by his REST experience or industry standards and practices. Chapters are well-structured and quite enjoyable to read. Topics become more advanced as the reader progresses through the book. However, the pace remains pretty consistent and explanation is always comprehensible and to the point.
First part of the book walks us through the basics of REST and JAX-RS, learning how to approach design and first implementation attempts. Author also presents basics of using resources which is extremely important for people starting with REST without any or just a little prior knowledge. These topics are followed by a description of JAX-RS fundamentals like injection mechanisms, content handlers, exception handling and Client API. This is where things got interesting for me because the following chapters where the best part of the book in my honest opinion. You get to learn about HATEOAS, scaling, filters, interceptors and caching. Book also describes other advanced parts of JAX-RS, but these are my favorite.
Second part of the book, called workbook, is filled with code examples for reader to try out, debug and play around with. This allows you to get deeper understanding and little bit of hands on, so it’s not just about reading. I found the amount of examples and their scope sufficient enough to understand what was explained in associated chapter.
Where it excels
It is pretty clear from previous paragraphs that I enjoyed this book. When I look for a study resource, one of key attributes is how cohesive the material is (aiming to minimize time spent on studying other frameworks/languages/specifications related to or mentioned in the book). Author managed to keep this book nicely organized and cohesive, which is nice. I also liked the way he tries to related the topic at hand to real world scenarios or applications.
Where it comes short
However there was one thing I missed here, that could be a nice addition to presented material. This book is clearly oriented on programming aspect of the REST APIs and services, but I would also welcome authors opinions on the design aspect of REST. It would be nice to have the opportunity to learn about JAX-RS and design principles, versioning strategies, documentation or more in-depth look at the use of HTTP status codes, but I guess this wasn’t the aim of this book in the first place.
In my point of view, reading this book was a pleasant experience. Given that this book is one of the most complete and comprehensive materials on this topic, I can say that this is a must read for every Java developer starting with REST services. This book is excellent resource if you are beginning with REST and JAX-RS fundamentals, but might not be suitable as a resource for advanced implementation needs. Given the state of the industry and the unprecedented rise of the API culture and economy, I believe this is an investment worth doing and I would highly recommend this book. Book covers both basics and advanced topics, so its suitable for newcomers as well as people looking to brush up on their Java RESTful web-services knowledge or to keep up to date with latest additions to the specification. I myself found many things about both REST and JAX-RS that I didn’t know before and that weren’t mentioned in other resources I went through. Final though – definitely worth reading.