// Update and send a bad etag with conditional PUT
cust . setCity ( "Bedford" );
response = customerTarget . request ()
. header ( "If-Match" , "JUNK" )
. put ( Entity . xml ( cust ));
Assert . assertEquals ( 412 , response . getStatus ());
response . close ();
Finally, the code does a conditional PUT with a bad ETag value sent with the If-Match
header. The client is expecting this operation to fail with a 412, “Precondition Failed,” re-
Build and Run the Example Program
Perform the following steps:
1. Open a command prompt or shell terminal and change to the ex11_1 directory of the
workbook example code.
2. Make sure your PATH is set up to include both the JDK and Maven, as described in
3. Perform the build and run the example by typing maven install .
Another interesting thing you might want to try is to start up and leave the application run-
Continually refresh this URL. You will be able to see if your browser performs a conditional
GET request or not by viewing the <last-viewed> element of the returned XML. I found
that Firefox 3.5.2 does a conditional GET, while Safari 4.0.1 does not.