Chapter 4 discussed three things. First, it mentioned how the
@javax.ws.rs.HttpMethod annotation works and how to define and bind Java methods to new HTTP methods. Next, it talked about the intricacies of the
@Path annotation, and explained how you can use complex regular expressions to define your application’s published URIs. Finally, the chapter went over the concept of subresource locators.
This chapter walks you through three different example programs that you can build and run to illustrate the concepts in Chapter 4. The first example uses
@HttpMethod to define a new HTTP method called PATCH. The second example expands on the customer service database example from Chapter 18 by adding some funky regular expression mappings with
@Path. The third example implements the subresource locator example shown in Full Dynamic Dispatching in Chapter 4.
This example shows you how your JAX-RS services can consume HTTP methods other than the common standard ones defined in HTTP 1.1. Specifically, the example implements the PATCH method. The PATCH method was originally mentioned in an earlier draft version of the HTTP 1.1 specification:
The PATCH method is similar to PUT except that the entity contains a list of differences between the original version of the resource identified by the Request-URI and the desired content of the resource after the PATCH action has been applied.
The idea of PATCH is that instead of transmitting ...