REST in Practice

Errata for REST in Practice

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed, PDF, Safari Books Online
Page 10
Figure 1-4

Order shows Coffee: Late. Presumably this should be "Latte", although "Payment: $3.50" represents a considerable discount to the market, and this may be a discount offered for tardiness.

Note from the Author or Editor:
Change the coffee part of the order (leftmost box in figure 1-4) to read: Coffee: Latte Note: this bug was introduced by O'Reilly's graphics people. It was not there in the source material.

Anonymous  Dec 29, 2010 
Safari Books Online
14
Figure 1-7

The green box representing state 3 shows links to states 1 and 5. However the link to state 5 (pink) actually points back to the pink box that represents state 6. I suggest correcting the numeral 5 in the pink link and in the black text below the box to 6, that would fix it.

Note from the Author or Editor:
The numeral "5" on top of the pink link inside the green box should be changed to "6", as per the reader's suggestion.

Anonymous  Sep 20, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 48
Just above the 'NOTE' column

It goes: ... to extract information from request payloads. Using the requestWriter, we're able to compute response messages for the consumer. but 'requestWriter' should be 'responseWriter' instead.

Note from the Author or Editor:
Page 48: the phrase: "Using the requestWriter, we're able..." must be changed to "Using the responseWriter, we're able"...

M.Tk  Feb 18, 2011 
Printed
Page 48
Just above the 'NOTE' column

This is an errata for the errata. The correction given at http://oreilly.com/catalog/errata.csp?isbn=9780596805838 says: "Using the requestWriter, we're able..." must be changed to "Using the reesponseWriter, we're able"... There's a typo here - it should ne "responseWriter" not "reesponseWriter"

Note from the Author or Editor:
This has been fixed.

Andy Wilson  May 04, 2012 
Printed, PDF, Safari Books Online, Other Digital Version
Page 64
Example 4-7

I wonder whether a <status/> field is missing in Ex 4-7. Maybe <status>paid</status>?

Note from the Author or Editor:
This is an accurate error. Example 4-7 should read: HTTP/1.1 200 OK Content-Length: 241 Content-Type: application/xml Date: Wed, 19 Nov 2008 21:48:10 GMT <order xmlns=&#8242;&#8242;http://schemas.restbucks.com/order&#8242;&#8242;> <location>takeAway</location> <items> <item> <name>latte</name> <quantity>1</quantity> <milk>whole</milk> <size>small</size> </item> </items> <status>paid</status> </order>

Anonymous  May 24, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 67
Code example

Example 4-12 should be able to throw different exceptions to represent an order being not found and some other internal server error. However the line throw new WebApplicationException(Response.Status.NOT_FOUND) is inside a try-block which will catch and rethrow, so it's impossible for a not-found-error to escape.

Note from the Author or Editor:
Example 4-12 should be changed to read exactly as follows: @Path("/order") public class OrderingService { @GET @Produces("application/xml") @Path("/{orderId}") public String getOrder(@PathParam("orderId") String orderId) { Order order = OrderDatabase.getDatabase().getOrder(orderId); if (order == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } else { try { return xstream.toXML(order); } catch (Exception e) { throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } } } // Remainder of implementation omitted for brevity }

Craig P. Motlin  Aug 15, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 69
1st Paragraph

"In accordance with the HTTP specification, a successful PUT request won’t create a new resource or produce a new URI." PUT can create a new resource. From http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6 "If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI."

Note from the Author or Editor:
It would be a good clarification to change this sentence: "In accordance with the HTTP specification, a successful PUT request won’t create a new resource or produce a new URI. Instead, the state of the identified resource will be updated to reflect the data in the request representation." to "In this case, a successful PUT request won’t create a new resource but will instead update the state of the identified resource to reflect the data in the request representation."

Greg Moulliet  Jun 09, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 99
In the @Path explanation after example 4-12

URI template {/orderId} should be /{orderId}

Note from the Author or Editor:
p.67 print edition, last bullet point: {/orderId} should be /{orderId}

Arjan Moraal  Oct 02, 2010 
Printed, PDF, Safari Books Online, Other Digital Version
Page 105
Example 5-5

The last end-tag should be </order> instead of </entry>.

Note from the Author or Editor:
Example 5-5 needs to be changed to be as follows: <order xmlns=&#8242;&#8242;http://schemas.restbucks.com&#8242;&#8242;> <location>takeAway</location> <item> <name>latte</name> <quantity>1</quantity> <milk>whole</milk> <size>small</size> </item> <cost>2.0</cost> <status>payment-expected</status> <link rel="http://relations.restbucks.com/payment" href="https://restbucks.com/payment/1234"/> <link rel="http://relations.restbucks.com/special-offer" href="http://restbucks.com/offers/cookie/1234"/> </order>

Kun Lee  Jul 23, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 117
Example 5-6

The link: <dap:link mediaType="application/vnd.restbucks+xml" uri="http://restbucks.com/order/1234" rel="self" /> should be replaced with: <dap:link uri="http://restbucks.com/order/1234" rel="self" /> The mediaType attribute should not be there, because a sentence on page 116 reads: "If a request does not require an entity body, the mediaType attribute will be absent". If I have understood correctly, the mediaType attribute should also be removed from other links: ... rel="http://relations.restbucks.com/cancel" ... on page 116 ... rel="http://relations.restbucks.com/order" ... on page 118 ... rel="http://relations.restbucks.com/receipt" ... 2 occurrences on page 118 ... many other occurrences on the following pages As I understand it, the GET and DELETE requests don't require an entity body. There are also minor mistakes: <ns2:payment should be <payment (example 5-8, on page 118) rel=http://relations.restbucks.com/self should be rel="self" (example 5-15, page 123)

Note from the Author or Editor:
Please change this paragraph: ---- If a request requires an entity body, the link element will contain a mediaType attribute that declares the format of the request payload. If a request does not require an entity body, the mediaType attribute will be absent. ---- To this, maintaining the formatting of code in paragraph. ---- If a request requires an entity body, the link element will contain a mediaType attribute that declares the format of the request payload. If a request does not require an entity body, and no other domain application protocol semantics need to be conveyed the mediaType attribute may be absent. ----

Mateusz Zakrzewski  May 05, 2012 
Printed, PDF, Safari Books Online, Other Digital Version
Page 124
Example 5-17

The end-point for the POST request should be /payment/coffee-card/1234 as advertised by the coffee-card-payment URI on the resource representation shown in example 5-16 (same page).

Note from the Author or Editor:
Please change Example 5-17 to read exactly as follows: POST /payment/coffee-card/1234 HTTP/1.1 Host: restbucks.com Content-Length: 270 Content-Type: application/vnd.restbucks+xml Date: Sun, 21 Mar 2010 19:08:22 GMT <coffeeCard xmlns="http://schemas.restbucks.com"> <link rel="http://relations.restbucks.com/self" href="http://restbucks.com/coffeecard/4456afd23"> <tamperProof>19590f1ed86f3b2ecaf911267067e8a8</tamperProof> <numberOfCoffees>9</numberOfCoffees> </coffeeCard>

Thiago Arrais  Jun 15, 2012 
Printed, PDF, Safari Books Online
Page 131
Figure 5-10

In Figure 5-10, box on top right, I think uri should be /order/{orderId} instead of /receipt/{orderId}.

Note from the Author or Editor:
In figure 5-10 the light orange box on the far right, second from the top is currently labeled "/receipt/{orderId}" This is wrong and is a bug introduced when O'Reilly had the figures for the book needlessly redrawn (the originals were accurate and visually more appealing than the O'Reilly house style). Please change that box so it reads: /order/{orderId}

Arjan Moraal  Oct 09, 2010 
PDF
Page 131
Figure 5-10

in Order Resource image, 'UpadateOrderActivity' -> 'UpdateOrderActivity'

Note from the Author or Editor:
Thank you for spotting this. "UpadateOrderActivity" should be changed to "UpdateOrderActivity".

Paul Roebuck  Sep 30, 2010 
Printed, PDF, Safari Books Online, Other Digital Version
Page 149
Example 5-31

PaymendReceived should be PaymentReceived

Note from the Author or Editor:
Change the line in Example 5-31 that reads: PUT PaymendReceived 201 => PaymentReceived to read: PUT PaymentReceived 201 => PaymentReceived Please maintain formatting.

Craig P. Motlin  Aug 30, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 210
Example 7-7

I think this piece of code if (validStartAndEndEntries(startPos, endPos)) { // Bad URI - the paramters don't align with our feeds return Response.status(Status.NOT_FOUND).build(); } should be if (!validStartAndEndEntries(startPos, endPos)) { // Bad URI - the parameters don't align with our feeds return Response.status(Status.NOT_FOUND).build(); } because it should return a 404 when the URI is invalid.

Note from the Author or Editor:
Example 7-7 should read: @GET @Path("/{startPos},{endPos}") @Produces("application/atom+xml") public Response getSpecificFeed(@PathParam("startPos") int startPos, @PathParam("endPos") int endPos) { if (invalidStartAndEndEntries(startPos, endPos)) { // Bad URI - the paramters don't align with our feeds return Response.status(Status.NOT_FOUND).build(); } if(workingFeedRequested(startPos)) { return getWorkingFeed(); } EventFeedGenerator generator = new EventFeedGenerator(uriInfo.getRequestUri(), ENTRIES_PER_FEED); Feed feed = generator.feedFor(startPos); return Response.ok().entity(stringify(feed)).header(CACHE_CONTROL_HEADER, cacheDirective(CachePolicy.getArchiveFeedLifetime())) .type(ATOM_MEDIA_TYPE).build(); } private Response getWorkingFeed() { EventFeedGenerator generator = new EventFeedGenerator(uriInfo.getRequestUri(), ENTRIES_PER_FEED); Feed feed = generator.getWorkingFeed(); return Response.ok().entity(stringify(feed)) .header(CACHE_CONTROL_HEADER, cacheDirective(CachePolicy.getWorkingFeedLifetime())) .type(ATOM_MEDIA_TYPE).build(); }

Kun Lee  Aug 06, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 217
First paragraph

The product and region elements are in the http://www.w3.org/2005/Atom namespace while they belong in the http://schemas.restbucks.com/promotion namespace. The elements <ns2:product ..> and <ns2:region .. > should be replaced by <product ..> and <region ..>. The attribute "xmlns:ns2" on the parent promotion element on page 216 is thereby unnecessary and can be removed.

Note from the Author or Editor:
Example 7-16 should be changed to read exactly as follows (maintaining all bold formatting): HTTP/1.1 200 OK server: grizzly/1.8.1 Cache-Control: max-age=2592000 Content-Type: application/atom+xml … <entry> <title>product</title> <link rel="self" href="http://restbucks.com/product-catalog/notifications/notifications/120" /> <link rel="related" href="http://restbucks.com/products/2012703733" /> <category term="product" scheme="http://restbucks.com/product-catalog/notifications/categories/type" /> <category term="new" scheme="http://restbucks.com/product-catalog/notifications/categories/status" /> <id>tag:restbucks.com,2009-08-15:120</id> <updated>2008-04-04T16:24:02Z</updated> <content type="application/vnd.restbucks+xml"> <product xmlns="http://schemas.restbucks.com/product" href="http://restbucks.com/products/2012703733"> <name>product name 543809053</name> <price>2.34</price> </product> </content> </entry> <entry> <title>promotion</title> <link rel="self" href="http://restbucks.com/product-catalog/notifications/notifications/148" /> <link rel="related" href="http://restbucks.com/promotions/1669488880" /> <category term="promotion" scheme="http://restbucks.com/product-catalog/notifications/categories/type" /> <category term="new" scheme="http://restbucks.com/product-catalog/notifications/categories/status" /> <id>tag:restbucks.com,2009-08-15:148</id> <updated>2008-04-04T16:24:02Z</updated> <content type="application/vnd.restbucks+xml"> <promotion xmlns="http://schemas.restbucks.com/promotion" href="http://restbucks.com/promotions/1669488880"> <effective>2009-08-15</effective> <product type="application/vnd.restbucks+xml" href="http://restbucks.com/products/1995649500" /> <region type="application/vnd.restbucks+xml" href="http://restbucks.com/regions/2140798621" /> </promotion> </content> </entry> …

Stig Inge Lea Bjørnsen  Sep 15, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 320
Figure 9-10

"comsumer" should be "consumer"

Note from the Author or Editor:
The text in the figure should change from "comsumer" to "consumer".

Anonymous  Jan 03, 2012 
PDF, Other Digital Version
Page 359
Figure 10-2

URI http://restbucks.com/vocab#tsemi -> should be http://restbucks.com/vocab/#semi ?

Note from the Author or Editor:
The URI should indeed be "http://restbucks.com/vocab/#semi".

Arjan Moraal  Oct 13, 2010 
PDF
Page 361
Figure 10-3

URL for currency should be "http://restbuck.com/vocab#uk-pounds" instead of "http://restbuck.com/vocab#latte".

Note from the Author or Editor:
Yes, this problem must have been introduced during the figure designs.

Jean-Luc Barras  Oct 19, 2010 
Printed, PDF, Safari Books Online, Other Digital Version
Page 3362
Figure 5-7

Here, even after stating that POST will be used for updates to an order, this figure indicates using PUT. The authors clearly changed their minds along the way somewhere.

Note from the Author or Editor:
In Figure 5-7, change: Update (PUT) to Update (POST)

Mike Williams  May 31, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 3365
Figure 5-7

(Page is Kindle location.) The "Update" link should be a POST rather than a PUT. This was explained in the "PUT verses POST" note a few pages prior, and matches the explanation of Example 5-6, where it mentions update is a POST.

Note from the Author or Editor:
In Figure 5-7 please change: Update (PUT) to Update (POST)

Jay Mitchell  Nov 20, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 3568
Example 5-15

(Page number is Kindle location.) Coffee card link should be rel="self"

Note from the Author or Editor:
Example 5-15 should read as follows: HTTP/1.1 200 OK Content-Length: 239 Content-Type: application/vnd.restbucks+xml Date: Sun, 21 Mar 2010 19:07:33 GMT <coffeeCard xmlns="http://schemas.restbucks.com"> <link rel="self" href="http://restbucks.com/coffeecard/4456afd23"> <tamperProof>fff405268fea556a351459e7368bc1d3</tamperProof> <numberOfCoffees>2</numberOfCoffees> </coffeeCard>

Jay Mitchell  Nov 20, 2011 
Printed, PDF, Safari Books Online, Other Digital Version
Page 5171
Explanation of Example 7-1

<atom:generated> should be <atom:generator>. (Example 7-1 itself is correct.)

Note from the Author or Editor:
On page 188 (eBook at least) the string: atom:generated should be atom:generator

Jay Mitchell  Nov 22, 2011