Java Reference
In-Depth Information
return "Your Product is: " + productId;
}
}
In this regular expression, you indicate that product IDs must be exactly three digits. If you
compile and deploy this resource and open your browser to the URL http://localhost:8080/res-
texamples/resources/products/555 , you'll see the following output:
Your Product is: 555
But if you open it to the URL http://localhost:8080/restexamples/resources/products/3 (which
has only a single-digit number in the ID parameter), you'll get a 404. The application is re-
sponding properly, and there is a resource there, but the ID doesn't match the constraints of
the expression. So in effect, in the REST world, there is no resource there. This may require a
slight adjustment in thought.
Search WWH ::




Custom Search