[JAVA][RESTful Java with JAX-RS 2.0, 2nd Edition].pdf

(7495 KB) Pobierz
www.it-ebooks.info
www.it-ebooks.info
SECOND EDITION
RESTful Java with JAX-RS 2.0
Bill Burke
www.it-ebooks.info
RESTful Java with JAX-RS 2.0, Second Edition
by Bill Burke
Copyright © 2014 Bill Burke. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Meghan Blanchette
Production Editor:
Melanie Yarbrough
Copyeditor:
Charles Roumeliotis
Proofreader:
Rachel Monaghan
November 2013:
Second Edition
Indexer:
Ellen Troutman-Zaig
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Rebecca Demarest
Revision History for the Second Edition:
2013-11-11:
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449361341
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
RESTful Java with JAX-RS 2.0,
Second Edition, the cover image of an Australian bee-eater, and
related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-36134-1
[LSI]
www.it-ebooks.info
Table of Contents
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Part I.
REST and the JAX-RS Standard
4
5
6
7
9
10
11
11
13
1. Introduction to REST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
REST and the Rebirth of HTTP
RESTful Architectural Principles
Addressability
The Uniform, Constrained Interface
Why Is the Uniform Interface Important?
Representation-Oriented
Communicate Statelessly
HATEOAS
Wrapping Up
2. Designing RESTful Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
The Object Model
Model the URIs
Defining the Data Format
Read and Update Format
Create Format
Assigning HTTP Methods
Browsing All Orders, Customers, or Products
Obtaining Individual Orders, Customers, or Products
Creating an Order, Customer, or Product
Updating an Order, Customer, or Product
Removing an Order, Customer, or Product
Cancelling an Order
15
16
17
17
19
19
20
21
21
23
24
24
iii
www.it-ebooks.info
Zgłoś jeśli naruszono regulamin