June 2014
Beginner to intermediate
304 pages
7h 25m
English
First, we will look at the @ResponseStatus annotation (org.springframework.web.bind.annotation.ResponseStatus). In Chapter 3, Control Your Store with Controllers, we created a request mapping method to display products by category under the URI template, http://localhost:8080/webstore/products/{category}. If no products were found under the given category, we would show an empty web page, which is not correct semantically. We should show an HTTP status error to indicate that no products exist under the given category. Let's see how we can do that with the help of the @ResponseStatus annotation:
NoProductsFoundUnderCategoryException under the com.packt.webstore.exception ...Read now
Unlock full access