Building a RESTful Web Service with Spring

A hands-on guide to building an enterprise-grade, scalable RESTful web service using the Spring Framework

Building a RESTful Web Service with Spring

This ebook is included in a Mapt subscription
Ludovic Dewailly

3 customer reviews
A hands-on guide to building an enterprise-grade, scalable RESTful web service using the Spring Framework
$0.00
$23.99
$29.99
$29.99p/m after trial
RRP $23.99
RRP $29.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785285714
Paperback128 pages

Book Description

REST is an architectural style that tackles the challenges of building scalable web services. In today’s connected world, APIs have taken a central role on the web. APIs provide the fabric through which systems interact, and REST has become synonymous with APIs.

The depth, breadth, and ease of use of Spring makes it one of the most attractive frameworks in the Java ecosystem. Marrying the two technologies is therefore a very natural choice.

This book takes you through the design of RESTful web services and leverages the Spring Framework to implement these services. Starting from the basics of the philosophy behind REST, you’ll go through the steps of designing and implementing an enterprise-grade RESTful web service. Taking a practical approach, each chapter provides code samples that you can apply to your own circumstances.

This book goes beyond the use of Spring and explores approaches to tackle resilience, security, and scalability concerns. You’ll learn techniques to deal with security in Spring and discover how to implement unit and integration test strategies.

Finally, the book ends by walking you through building a Java client for your RESTful web service, along with some scaling techniques for it.

Table of Contents

Chapter 1: A Few Basics
REST principles
The Spring Framework and REST
Our RESTful web service
Summary
Chapter 2: Building RESTful Web Services with Maven and Gradle
Apache Maven
Gradle
The structure of our sample web service
Developing RESTful web services
Summary
Chapter 3: The First Endpoint
The Inventory service
REST and the MVC pattern
Running the service
A few words on data representation
Summary
Chapter 4: Data Representation
The Data-Transfer-Object design pattern
The API response format
API evolutions
Summary
Chapter 5: CRUD Operations in REST
Mapping CRUD operations to HTTP methods
Creating resources
Updating resources
Deleting resources
Overriding the HTTP method
Summary
Chapter 6: Performance
HTTP compression
HTTP caching
Room availability
Summary
Chapter 7: Dealing with Security
The booking service
Authentication
Authorization
Input validation
Encryption
Summary
Chapter 8: Testing RESTful Web Services
Unit testing Spring controllers
Mocking
Testing security
Integration testing
Other forms of testing
Summary
Chapter 9: Building a REST Client
The basic setup
Remote versus local clients
Handling security
Exception handling
Summary
Chapter 10: Scaling a RESTful Web Service
Clustering
Distributed caching
Asynchronous communication
Summary

What You Will Learn

  • Deep dive into the principles behind REST
  • Expose CRUD operations through RESTful endpoints with the Spring Framework
  • Devise response formats and error handling strategies, offering a consistent and flexible structure to simplify integration for service consumers
  • Follow the best approaches for dealing with a service’s evolution while maintaining backward compatibility
  • Understand techniques to secure web services
  • Comply with the best ways to test RESTful web services, including tips for load testing
  • Optimise and scale web services using techniques such as caching and clustering

Authors

Table of Contents

Chapter 1: A Few Basics
REST principles
The Spring Framework and REST
Our RESTful web service
Summary
Chapter 2: Building RESTful Web Services with Maven and Gradle
Apache Maven
Gradle
The structure of our sample web service
Developing RESTful web services
Summary
Chapter 3: The First Endpoint
The Inventory service
REST and the MVC pattern
Running the service
A few words on data representation
Summary
Chapter 4: Data Representation
The Data-Transfer-Object design pattern
The API response format
API evolutions
Summary
Chapter 5: CRUD Operations in REST
Mapping CRUD operations to HTTP methods
Creating resources
Updating resources
Deleting resources
Overriding the HTTP method
Summary
Chapter 6: Performance
HTTP compression
HTTP caching
Room availability
Summary
Chapter 7: Dealing with Security
The booking service
Authentication
Authorization
Input validation
Encryption
Summary
Chapter 8: Testing RESTful Web Services
Unit testing Spring controllers
Mocking
Testing security
Integration testing
Other forms of testing
Summary
Chapter 9: Building a REST Client
The basic setup
Remote versus local clients
Handling security
Exception handling
Summary
Chapter 10: Scaling a RESTful Web Service
Clustering
Distributed caching
Asynchronous communication
Summary

Book Details

ISBN 139781785285714
Paperback128 pages
Read More
From 3 reviews

Read More Reviews