万本电子书0元读

万本电子书0元读

顶部广告

Building a RESTful Web Service with Spring电子书

售       价:¥

16人正在读 | 0人评论 6.2

作       者:Ludovic Dewailly

出  版  社:Packt Publishing

出版时间:2015-10-14

字       数:52.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
A hands-on guide to building an enterprise-grade, scalable RESTful web service using the Spring FrameworkAbout This BookFollow best practices and explore techniques such as clustering and caching to achieve a scalable web serviceLeverage the Spring Framework to quickly implement RESTful endpointsLearn to implement a client library for a RESTful web service using the Spring Framework Who This Book Is For This book is intended for those who want to learn to build RESTful web services with the Spring Framework. To make best use of the code samples included in the book, you should have a basic knowledge of the Java language. Previous experience with the Spring Framework would also help you get up and running quickly.What You Will LearnDeep dive into the principles behind RESTExpose CRUD operations through RESTful endpoints with the Spring FrameworkDevise response formats and error handling strategies, offering a consistent and flexible structure to simplify integration for service consumersFollow the best approaches for dealing with a service’s evolution while maintaining backward compatibilityUnderstand techniques to secure web servicesComply with the best ways to test RESTful web services, including tips for load testingOptimise and scale web services using techniques such as caching and clustering In Detail 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.Style and approach This book is a step-by-step, hands-on guide to designing and building RESTful web services. The book follows the natural cycle of developing these services and includes multiple code samples to help you.
目录展开

Building a RESTful Web Service with Spring

Table of Contents

Building a RESTful Web Service with Spring

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. A Few Basics

REST principles

Uniform interface

Client-Server

Stateless

Cacheable

Layered system

Code on demand

The Spring Framework and REST

Our RESTful web service

Architecture

Data model

Summary

2. Building RESTful Web Services with Maven and Gradle

Apache Maven

Dependency management in Apache Maven

Gradle

Dependency management in Gradle

The structure of our sample web service

The anatomy of a Service Module

Local versus Remote Service Invocations

Developing RESTful web services

Working with your favorite IDE

Making services executable

Starting services with Maven

Summary

3. The First Endpoint

The Inventory service

REST and the MVC pattern

Request mapping

Path mapping

HTTP method mapping

Request parameter mapping

Running the service

A few words on data representation

Summary

4. Data Representation

The Data-Transfer-Object design pattern

The API response format

The envelope format

Error management

Pagination support

Customizing JSON responses

API evolutions

HATEOAS

Versioning strategies

URI versioning

Representation versioning

Other approaches

Summary

5. CRUD Operations in REST

Mapping CRUD operations to HTTP methods

Creating resources

Quickly testing endpoints

JSON versus form data

Updating resources

The update endpoint

Testing update requests

Deleting resources

Overriding the HTTP method

Summary

6. Performance

HTTP compression

Content negotiation

gzip or deflate?

gzip compression in RESTful web services

Spring Boot

HTTP caching

Cache-Control

Private/Public caching

No caching

ETags

Last-Modified/If-Modified-Since headers

Room availability

An overview of implementation

The REST resource

Adding HTTP caching

Caching with ETags

Summary

7. Dealing with Security

The booking service

The REST resource

Authentication

HTTP Basic authentication

Using Basic authentication with Spring

HTTP Digest authentication

Token-based authentication

Other authentication methods

Authorization

Authorization with Spring

URL mapping

Resource annotations

Input validation

Java Bean annotations

Regular expressions

Validating bookings

Encryption

Storing sensitive data

Summary

8. Testing RESTful Web Services

Unit testing Spring controllers

Mocking

Simple mocking

Implementation stubbing with a mocking library

Mockito and Spring

Testing security

Integration testing

Continuous delivery

Integration tests with Spring Boot

Postman

Postman and security

Other forms of testing

User Acceptance Testing

Load testing

Summary

9. Building a REST Client

The basic setup

Declaring a client

Remote versus local clients

Availability and booking services

Handling security

The Basic authentication

The Digest authentication

HTTP public key pinning

Exception handling

Summary

10. Scaling a RESTful Web Service

Clustering

Scaling up versus scaling out

The benefits of clustered systems

Load balancing

Linear scalability

Distributed caching

Data-tier caching

First-level caching

Second-level caching

Application-tier caching

Asynchronous communication

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部