Java Reference
In-Depth Information
tomers/Bill-Burke
. The name can only have letters within it, so
/customers/
Bill7-Burke
would result in a 404, “Not Found,” being returned to the client.
The Client Code
The client code is in
src/test/java/com/restfully/shop/test/ClientResourceTest.java
. It is really
not much different than the code in example
ex03_1
, other than the fact that it additionally
invokes the URI represented by the
getCustomerFirstLast()
method. If you've examined
the code from
Chapter 18
, you can probably understand what is going on in this client ex-
ample, so I won't elaborate further.
Example ex04_3: Subresource Locators
The
ex04_3
example implements the subresource locator example shown in
Full Dynamic
Dispatching
in
Chapter 4
.
Build and Run the Example Program
Perform the following steps:
1. Open a command prompt or shell terminal and change to the
ex04_3
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
.
The Server Code
There's really not much to go over that wasn't explained in
Chapter 4
.
The Client Code
The client code lives in
src/test/java/com/restfully/shop/test/CustomerResourceTest.java
:
public
public class
class
CustomerResourceTest
CustomerResourceTest
{
@Test
public
public
void
void
testCustomerResource
()
throws
throws
Exception
{
...
}
@Test
public
public
void
void
testFirstLastCustomerResource
()
throws
throws
Exception
{