Chapter 4. Building a REST API for a Stateless Architecture

This chapter will present the following recipes:

  • Binding requests and marshalling responses
  • Configuring the content-negotiation (json, xml, and so on)
  • Adding pagination, filters, and sorting capabilities
  • Handling exceptions globally
  • Documenting and exposing an API with Swagger

Introduction

In this chapter, quite a few changes will be implemented. In fact, this chapter really sets our application development on an acceleration ramp.

Before diving into the code, we need to brush up on a few concepts about REST.

A definition of REST

REST is an architecture style. Its name is an abbreviation for Representational State Transfer. The term was invented by Roy Fielding, one of the principal authors of ...

Get Spring MVC Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.