Java Reference
In-Depth Information
Assert . assertEquals ( 204 , response . getStatus ());
response . close ();
}
If there is a cancel link relationship, the client posts an empty message to this URL to can-
cel the order:
System . out . println ();
System . out . println ( "** New list of orders after cancel: " );
orderList = client . target ( orders ). request (). get ( String . class );
System . out . println ( orderList );
The client does another GET /orders to show that the state of our created order was set to
cancelled:
System . out . println ();
System . out . println ( "** Purge cancelled orders at URL: "
+ purge . getUri (). toString ());
response = client . target ( purge ). request (). post ( null
null );
Assert . assertEquals ( 204 , response . getStatus ());
response . close ();
System . out . println ();
System . out . println ( "** New list of orders after purge: " );
orderList = client . target ( orders ). request (). get ( String . class );
System . out . println ( orderList );
}
Finally, by posting an empty message to the purge link, the client cleans the order entry
database of any cancelled orders.
Build and Run the Example Program
Perform the following steps:
1. Open a command prompt or shell terminal and change to the ex10_2 directory of the
workbook example code.
2. Make sure your PATH is set up to include both the JDK and Maven, as described in
Chapter 17 .
3. Perform the build and run the example by typing maven install .
Search WWH ::




Custom Search