𝔖 Scriptorium
✦   LIBER   ✦

📁

RESTful Java with JAX-RS 2.0: [designing and developing distributed web services]

✍ Scribed by Burke, Bill


Publisher
O'Reilly Media
Year
2013;2014
Tongue
English
Leaves
392
Edition
2. ed
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


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 book’s technical guide, you’ll 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

✦ Table of Contents


Cover......Page 1
Copyright......Page 4
Table of Contents......Page 5
Foreword......Page 15
Author’s Note......Page 17
Part I, REST and the JAX-RS Standard......Page 18
Conventions Used in This Book......Page 20
Using Code Examples......Page 21
How to Contact Us......Page 22
Acknowledgments......Page 23
Part I. REST and the JAX-RS Standard......Page 25
Chapter 1. Introduction to REST......Page 27
REST and the Rebirth of HTTP......Page 28
RESTful Architectural Principles......Page 29
Addressability......Page 30
The Uniform, Constrained Interface......Page 31
Why Is the Uniform Interface Important?......Page 33
Representation-Oriented......Page 34
HATEOAS......Page 35
Wrapping Up......Page 37
The Object Model......Page 39
Model the URIs......Page 40
Read and Update Format......Page 41
Assigning HTTP Methods......Page 43
Browsing All Orders, Customers, or Products......Page 44
Creating an Order, Customer, or Product......Page 45
Updating an Order, Customer, or Product......Page 47
Cancelling an Order......Page 48
Wrapping Up......Page 50
Developing a JAX-RS RESTful Service......Page 51
Customer: The Data Class......Page 52
CustomerResource: Our JAX-RS Service......Page 53
JAX-RS and Java Interfaces......Page 59
Inheritance......Page 61
Deploying Our Service......Page 62
Writing a Client......Page 64
Wrapping Up......Page 66
Binding HTTP Methods......Page 67
HTTP Method Extensions......Page 68
Binding URIs......Page 69
@Path Expressions......Page 70
Subresource Locators......Page 74
Full Dynamic Dispatching......Page 76
Gotchas in Request Matching......Page 77
Wrapping Up......Page 79
The Basics......Page 81
More Than One Path Parameter......Page 82
PathSegment and Matrix Parameters......Page 83
@MatrixParam......Page 85
@QueryParam......Page 86
@FormParam......Page 87
Raw Headers......Page 88
@CookieParam......Page 89
@BeanParam......Page 91
Automatic Java Type Conversion......Page 92
@Encoded......Page 96
Wrapping Up......Page 97
javax.ws.rs.core.StreamingOutput......Page 99
java.io.InputStream, java.io.Reader......Page 100
java.io.File......Page 102
String, char[]......Page 103
javax.xml.transform.Source......Page 104
Intro to JAXB......Page 105
JAXB JAX-RS Handlers......Page 108
JAXB and JSON......Page 111
JSON and JSON Schema......Page 113
MessageBodyWriter......Page 115
MessageBodyReader......Page 120
Life Cycle and Environment......Page 121
Wrapping Up......Page 122
Default Response Codes......Page 123
Error Responses......Page 124
Complex Responses......Page 125
Returning Cookies......Page 128
The Status Enum......Page 129
Exception Handling......Page 130
javax.ws.rs.WebApplicationException......Page 131
Exception Mapping......Page 132
Exception Hierarchy......Page 133
Wrapping Up......Page 135
Client Introduction......Page 137
Bootstrapping with ClientBuilder......Page 138
Client and WebTarget......Page 139
Building and Invoking Requests......Page 140
Invocation......Page 145
Exception Handling......Page 146
Configuration Scopes......Page 147
Wrapping Up......Page 148
Conneg Explained......Page 149
Preference Ordering......Page 150
Encoding Negotiation......Page 151
Method Dispatching......Page 152
Complex Negotiation......Page 153
Negotiation by URI Patterns......Page 158
Leveraging Content Negotiation......Page 159
Flexible Schemas......Page 160
Wrapping Up......Page 162
Chapter 10. HATEOAS......Page 163
Atom Links......Page 164
Advantages of Using HATEOAS with Web Services......Page 165
Link Headers Versus Atom Links......Page 168
Building URIs with UriBuilder......Page 169
Relative URIs with UriInfo......Page 173
Building Links and Link Headers......Page 176
Embedding Links in XML......Page 178
Wrapping Up......Page 179
Caching......Page 181
Expires Header......Page 182
Cache-Control......Page 183
Revalidation and Conditional GETs......Page 185
Concurrency......Page 188
JAX-RS and Conditional Updates......Page 190
Wrapping Up......Page 191
Server-Side Filters......Page 193
Server Request Filters......Page 194
Server Response Filters......Page 195
Reader and Writer Interceptors......Page 196
Client-Side Filters......Page 198
Ordering Filters and Interceptors......Page 201
DynamicFeature......Page 203
Name Bindings......Page 205
DynamicFeature Versus @NameBinding......Page 206
Wrapping Up......Page 207
Using Futures......Page 209
Using Callbacks......Page 213
Server Asynchronous Response Processing......Page 215
AsyncResponse API......Page 216
Exception Handling......Page 218
Cancel......Page 219
Timeouts......Page 220
Use Cases for AsyncResponse......Page 221
Wrapping Up......Page 225
Deployment......Page 227
The Application Class......Page 228
Deployment Within a JAX-RS-Aware Container......Page 229
Deployment Within a JAX-RS-Unaware Container......Page 231
Basic Configuration......Page 232
EJB Integration......Page 235
Spring Integration......Page 236
Wrapping Up......Page 238
Chapter 15. Securing JAX-RS......Page 239
Basic Authentication......Page 240
Digest Authentication......Page 241
Authentication and Authorization in JAX-RS......Page 243
Enforcing Encryption......Page 245
Authorization Annotations......Page 246
Programmatic Security......Page 248
Client Security......Page 249
OAuth 2.0......Page 250
Digital Signatures......Page 252
Encrypting Representations......Page 256
Wrapping Up......Page 257
java.net.URL......Page 259
Authentication......Page 261
Advantages and Disadvantages......Page 263
Apache HttpClient......Page 264
Authentication......Page 266
RESTEasy Client Proxies......Page 268
Wrapping Up......Page 269
Part II. JAX-RS Workbook......Page 271
Installing RESTEasy and the Examples......Page 273
Environment Setup......Page 275
Build and Run the Example Program......Page 277
Deconstructing pom.xml......Page 278
Running the Build......Page 283
Examining the Source Code......Page 285
Example ex04_1: HTTP Method Extension......Page 287
The Server Code......Page 288
The Client Code......Page 289
The Server Code......Page 290
The Client Code......Page 292
The Server Code......Page 295
The Client Code......Page 298
The Server Code......Page 299
Build and Run the Example Program......Page 301
Example ex06_1: Using JAXB......Page 303
The Client Code......Page 305
Build and Run the Example Program......Page 306
The Content Handler Code......Page 307
The Application Class......Page 309
Build and Run the Example Program......Page 310
Example ex07_1: ExceptionMapper......Page 311
The Client Code......Page 313
Build and Run the Example Program......Page 314
Example ex09_1: Conneg with JAX-RS......Page 315
The Client Code......Page 316
The Server Code......Page 317
Build and Run the Example Program......Page 318
Example ex10_1: Atom Links......Page 319
The Server Code......Page 320
Example ex10_2: Link Headers......Page 323
The Server Code......Page 324
The Client Code......Page 328
Build and Run the Example Program......Page 330
The Server Code......Page 331
The Client Code......Page 334
Build and Run the Example Program......Page 335
The Server Code......Page 337
The Client Code......Page 338
Example ex12_2: Implementing a WriterInterceptor......Page 339
The Client Code......Page 340
Build and Run the Example Program......Page 341
Example ex13_1: Chat REST Interface......Page 343
The Client Code......Page 344
The Server Code......Page 346
Build and Run the Example Program......Page 350
Project Structure......Page 351
The EJBs......Page 352
The Remaining Server Code......Page 357
The Client Code......Page 358
Example ex14_2: Spring and JAX-RS......Page 361
Build and Run the Example Program......Page 364
One-Time Password Authentication......Page 365
Allowed-per-Day Access Policy......Page 369
Example ex15_1: JSON Web Encryption......Page 375
Build and Run the Example Program......Page 377
Index......Page 379
About the Author......Page 392

✦ Subjects


Nonfiction;Computer Science;Computers;Science;Technology


📜 SIMILAR VOLUMES


RESTful Java with JAX-RS: [designing and
✍ Burke, Bill 📂 Library 📅 2010 🏛 O'Reilly Media 🌐 English

<p>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 l

RESTful Java with JAX-RS 2.0, 2nd Editio
✍ Bill Burke 📂 Library 📅 2013 🏛 O'Reilly Media 🌐 English

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

Developing RESTful services with JAX-RS
✍ Kalali, Masoud; Mehta, Bhakti 📂 Library 📅 2013 🏛 Packt Publishing 🌐 English

<p>Improving your productivity by making the most of Java EE 7's capabilities is made easy and practical with this book. It's the perfect guide to developing RESTful Services utilizing powerful new technologies.</p> <p><b>Overview</b></p> <ul> <li>Learning about different client/server communication

Developing RESTful services with JAX-RS
✍ Kalali, Masoud; Mehta, Bhakti 📂 Library 📅 2013 🏛 Packt Publishing 🌐 English

<p>Improving your productivity by making the most of Java EE 7's capabilities is made easy and practical with this book. It's the perfect guide to developing RESTful Services utilizing powerful new technologies.</p> <p><b>Overview</b></p> <ul> <li>Learning about different client/server communication

RESTful Java with JAX-RS 2.0
✍ Bill Burke 📂 Library 📅 2013 🏛 O'Reilly Media 🌐 English

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

RESTful Java with JAX-RS 2.0
✍ Bill Burke 📂 Library 📅 2013 🏛 O'Reilly Media 🌐 English

<DIV><p>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