Over a million developers have joined DZone.

Book Review: RESTful Java Patterns and Best Practices

· Java Zone

Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.

This is review of the book RESTful Java Patterns and Best Practices


What is this book about and how can you possibly benefit from it ?

Its primarily geared towards readers who are interested in taking their REST web service development skills to the next level and empower them to build scalable, reliable, and maintainable high performance RESTful services.

This book is not a reference text for learning RESTful web application development. You can refer to other foundation level material including Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON (by the same author).

The book covers more than just how to write code using the JAX-RS API.

You need not be a REST or JAX-RS guru in order to extract value out of this book. It would prove very useful for developers or architects who have basic knowledge of RESTful web services + JAX-RS and want to delve into the finer/advanced details such as

  • Design Principles
  • Security
  • Scalability
  • Performance
  • Best Practices and
  • Explore real world solutions based on REST (Twitter, Facebook etc).

Who has written this book?

This book has been written by Bhakti Mehta. She tweets at @bhakti_mehta

What does the book cover?

The book is divided into 6 chapters

Chapter 1: REST – Where It Begins

  • Deals with basic tenets of REST and RESTful Web Services at large – Statelessness, Idempotence, indicator of a truly RESTful service as per the Richardson Maturity model
  • Briefly outlines design principles for building REST based web services
  • Overview of the JAX-RS (2.0) API – both from a server and client perspective

Chapter 2: Resource Design

  • Covers Content Negotiation – using HTTP headers and URL patterns
  • Entity Providers in JAX-RS – how to use MessageBodyReader, MessageBodyWriter and other alternatives like StreamingOutput and ChunkedOutput
  • How to deal with JSON representations with Jersey – options such as JAXB, Jackson or the JSON-P API (Java EE 7)
  • Strategies for handling versioning in line with the evolution of a RESTful API

Chapter 3: Security and Traceability

  • Overview of the individual components in a typical RESTful application/stack
  • REST API Security – Authentication, Authorization, using OAuth and OpenID Connect, TLS (SSL)
  • Implementing validation – leveraging Bean Validation (JSR???) along with JAX-RS
  • Effective Exception Handling – map application (business logic) specific errors to sensible user defined expections using Exception Mapper support in the JAX-RS API
  • Best practices in terms of logging your RESTful API

Chapter 4: Designing for Performance

  • Caching strategies for reducing latency and improving application responsiveness
  • Asynchronous Processing – how to use the JAX-RS API to process request and responses (both server and client) in an async fashion along with its associated best practices
  • Using HTTP Patch for scenarios which need to take care of partial updates

Chapter 5: Advanced Design Principles

  • Application of Rate limiting (throttling) patterns and best practices to avoid misuse of server side resources by clients
  • Response pagination techniques to improve end user experience
  • Further exploration of HATEOAS (Paypal API example) and a brief discussion about RESTful services testing and documentation

Chapter 6: Emerging Standards and The Future of REST

Real Time APIs are the pre-dominant theme of this lesson.

  • Techniques for creating Real Time RESTful APIs – Polling (SSE), WebHooks, WebSockets, XMPP
  • Quick yet useful coverage of Micro Services

Standout features

Some of the points which in my opinion were great

  • The book deals with inherently complex topics (security, scalability, performance, design concepts and best practices), provides a general understanding of the same at the same time ensuring that the reader gets enough technical insight to be able to apply the knowledge easily. It’s more than just API and related code.
  • Chapter 6 made for a really interesting read !
  • Provides ample real world examples by exploration of RESTful APIs from Twitter, Facebook, GitHub, Paypal etc (interspersed within the chapters as well as the Appendices). This really helps cement the concepts and topics in an effective manner. Always great for developers and architects (beginner or experienced) to learn from the best!


If you are looking to further enrich your knowledge in the RESTful web services area in general along with JAX-RS 2.0, you should definitely consider this book. You can grab it from Packtpub

Happy Reading! :-)

Building Identity Management, including authentication and authorization? Try Stormpath! Our REST API and robust Java SDK support can eliminate your security risk and can be implemented in minutes. Sign up, and never build auth again!


Published at DZone with permission of Abhishek Gupta, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}