Synopses & Reviews
Learn how to design and develop distributed web services in Java using RESTful architectural principals and the JAX-RS specification in Java EE 6. With this hands-on reference, you'll focus on implementation rather than theory, and discover why the RESTful method is far better than technologies like CORBA and SOAP.
It's easy to get started with services based on the REST architecture. RESTful Java with JAX-RS includes a technical guide that explains REST and JAX-RS, how they work, and when to use them. With the RESTEasy workbook that follows, you get step-by-step instructions for installing, configuring, and running several working JAX-RS examples using the JBoss RESTEasy implementation of JAX-RS.
This new edition focuses on JAX-RS 2.0. With the specification expected in Spring 2013, and Java EE 7 slated to be out in Summer 2013, 2.0 includes significant new additions. This edition will get you up to speed on these new aspects, which include a client API, server-side asynchronous HTTP, and filters and interceptors.
- Work on the design of a distributed RESTful interface, and develop it in Java as a JAX-RS service
- Dispatch HTTP requests in JAX-RS, and learn how to extract information from them
- Deploy your web services within Java Enterprise Edition using the Application class, Default Component Model, EJB Integration, Spring Integration, and JPA
- Discover several options for securing your web services
- Learn how to implement RESTful design patterns using JAX-RS
- Write RESTful clients in Java using libraries and frameworks such as java.net.URL, Apache HTTP Client, and RESTEasy Proxy
Learn how to design and develop distributed web services in Java, using RESTful architectural principles and the JAX-RS 2.0 specification in Java EE 7. By focusing on implementation rather than theory, this hands-on reference demonstrates how easy it is to get started with services based on the REST architecture.
With the books technical guide, youll learn how REST and JAX-RS work and when to use them. The RESTEasy workbook that follows provides step-by-step instructions for installing, configuring, and running several working JAX-RS examples, using the JBoss RESTEasy implementation of JAX-RS 2.0.
- Learn JAX-RS 2.0 features, including a client API, server-side asynchronous HTTP, and filters and interceptors
- Examine the design of a distributed RESTful interface for an e-commerce order entry system
- Use the JAX-RS Response object to return complex responses to your client (ResponseBuilder)
- Increase the performance of your services by leveraging HTTP caching protocols
- Deploy and integrate web services within Java EE7, servlet containers, EJB, Spring, and JPA
- Learn popular mechanisms to perform authentication on the Web, including client-side SSL and OAuth 2.0
About the Author
Bill Burke is a Fellow at the JBoss division of REd Hat Inc. A long time JBoss contributor and architect, his current project is RESTEasy, RESTful Web Services for Java.
Table of Contents
Foreword; Preface; Author's Note; Who Should Read This Book; How This Book Is Organized; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; REST and the JAX-RS Standard; Chapter 1: Introduction to REST; 1.1 REST and the Rebirth of HTTP; 1.2 RESTful Architectural Principles; 1.3 Wrapping Up; Chapter 2: Designing RESTful Services; 2.1 The Object Model; 2.2 Model the URIs; 2.3 Defining the Data Format; 2.4 Assigning HTTP Methods; 2.5 Wrapping Up; Chapter 3: Your First JAX-RS Service; 3.1 Developing a JAX-RS RESTful Service; 3.2 Deploying Our Service; 3.3 Writing a Client; 3.4 Wrapping Up; Chapter 4: HTTP Method and URI Matching; 4.1 Binding HTTP Methods; 4.2 @Path; 4.3 Subresource Locators; 4.4 Gotchas in Request Matching; 4.5 Wrapping Up; Chapter 5: JAX-RS Injection; 5.1 The Basics; 5.2 @PathParam; 5.3 @MatrixParam; 5.4 @QueryParam; 5.5 @FormParam; 5.6 @HeaderParam; 5.7 @CookieParam; 5.8 @BeanParam; 5.9 Common Functionality; 5.10 Wrapping Up; Chapter 6: JAX-RS Content Handlers; 6.1 Built-in Content Marshalling; 6.2 JAXB; 6.3 Custom Marshalling; 6.4 Wrapping Up; Chapter 7: Server Responses and Exception Handling; 7.1 Default Response Codes; 7.2 Complex Responses; 7.3 Exception Handling; 7.4 Wrapping Up; Chapter 8: JAX-RS Client API; 8.1 Client Introduction; 8.2 Bootstrapping with ClientBuilder; 8.3 Client and WebTarget; 8.4 Building and Invoking Requests; 8.5 Configuration Scopes; 8.6 Wrapping Up; Chapter 9: HTTP Content Negotiation; 9.1 Conneg Explained; 9.2 Language Negotiation; 9.3 Encoding Negotiation; 9.4 JAX-RS and Conneg; 9.5 Leveraging Content Negotiation; 9.6 Wrapping Up; Chapter 10: HATEOAS; 10.1 HATEOAS and Web Services; 10.2 HATEOAS and JAX-RS; 10.3 Building Links and Link Headers; 10.4 Wrapping Up; Chapter 11: Scaling JAX-RS Applications; 11.1 Caching; 11.2 Concurrency; 11.3 Wrapping Up; Chapter 12: Filters and Interceptors; 12.1 Server-Side Filters; 12.2 Reader and Writer Interceptors; 12.3 Client-Side Filters; 12.4 Deploying Filters and Interceptors; 12.5 Ordering Filters and Interceptors; 12.6 Per-JAX-RS Method Bindings; 12.7 Exception Processing; 12.8 Wrapping Up; Chapter 13: Asynchronous JAX-RS; 13.1 AsyncInvoker Client API; 13.2 Server Asynchronous Response Processing; 13.3 Wrapping Up; Chapter 14: Deployment and Integration; 14.1 Deployment; 14.2 Configuration; 14.3 EJB Integration; 14.4 Spring Integration; 14.5 Wrapping Up; Chapter 15: Securing JAX-RS; 15.1 Authentication; 15.2 Authorization; 15.3 Authentication and Authorization in JAX-RS; 15.4 Programmatic Security; 15.5 Client Security; 15.6 OAuth 2.0; 15.7 Signing and Encrypting Message Bodies; 15.8 Wrapping Up; Chapter 16: Alternative Java Clients; 16.1 java.net.URL; 16.2 Apache HttpClient; 16.3 RESTEasy Client Proxies; 16.4 Wrapping Up; JAX-RS Workbook; Chapter 17: Workbook Introduction; 17.1 Installing RESTEasy and the Examples; 17.2 Example Requirements and Structure; Chapter 18: Examples for Chapter 3; 18.1 Build and Run the Example Program; 18.2 Examining the Source Code; Chapter 19: Examples for Chapter 4; 19.1 Example ex04_1: HTTP Method Extension; 19.2 Example ex04_2: @Path with Expressions; 19.3 Example ex04_3: Subresource Locators; Chapter 20: Examples for Chapter 5; 20.1 Example ex05_1: Injecting URI Information; 20.2 Example ex05_2: Forms and Cookies; Chapter 21: Examples for Chapter 6; 21.1 Example ex06_1: Using JAXB; 21.2 Example ex06_2: Creating a Content Handler; Chapter 22: Examples for Chapter 7; 22.1 Example ex07_1: ExceptionMapper; Chapter 23: Examples for Chapter 9; 23.1 Example ex09_1: Conneg with JAX-RS; 23.2 Example ex09_2: Conneg via URL Patterns; Chapter 24: Examples for Chapter 10; 24.1 Example ex10_1: Atom Links; 24.2 Example ex10_2: Link Headers; Chapter 25: Examples for Chapter 11; 25.1 Example ex11_1: Caching and Concurrent Updates; Chapter 26: Examples for Chapter 12; 26.1 Example ex12_1 : ContainerResponseFilter and DynamicFeature; 26.2 Example ex12_2: Implementing a WriterInterceptor; Chapter 27: Examples for Chapter 13; 27.1 Example ex13_1: Chat REST Interface; Chapter 28: Examples for Chapter 14; 28.1 Example ex14_1: EJB and JAX-RS; 28.2 Example ex14_2: Spring and JAX-RS; Chapter 29: Examples for Chapter 15; 29.1 Example ex15_1: Custom Security; 29.2 Example ex15_1: JSON Web Encryption; Index; Colophon;