Class CategoriesResource
- java.lang.Object
-
- ejava.examples.ejbwar.inventory.rs.CategoriesResource
-
@Path("categories") public class CategoriesResource extends Object
This class implements a web facade for the product catageories in the inventory management. It uses JAX-RS to implement the server-side HTTP communications.
-
-
Field Summary
Fields Modifier and Type Field Description private InventoryMgmtEJB
ejb
private static org.slf4j.Logger
log
private javax.ws.rs.core.Request
request
private javax.ws.rs.core.UriInfo
uriInfo
-
Constructor Summary
Constructors Constructor Description CategoriesResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
deleteCategory(int id)
This method responds to DELETE method calls to (root)/{id} URIs to delete a specific category.javax.ws.rs.core.Response
findCategoriesByName(String name, int offset, int limit)
This method will respond to a GET of the base resource URI to return categories based on query parameters.javax.ws.rs.core.Response
getCategory(int id)
This method will respond to a GET method for (root)/{id} URIs to get a specific category.
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
ejb
@Inject private InventoryMgmtEJB ejb
-
request
@Context private javax.ws.rs.core.Request request
-
uriInfo
@Context private javax.ws.rs.core.UriInfo uriInfo
-
-
Method Detail
-
findCategoriesByName
@GET @Path("") @Produces({"application/xml","application/json"}) public javax.ws.rs.core.Response findCategoriesByName(@QueryParam("name") @DefaultValue("") String name, @QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("limit") @DefaultValue("0") int limit)
This method will respond to a GET of the base resource URI to return categories based on query parameters.- Parameters:
name
-offset
-limit
-- Returns:
-
getCategory
@GET @Path("{id}") @Produces({"application/xml","application/json"}) public javax.ws.rs.core.Response getCategory(@PathParam("id") int id)
This method will respond to a GET method for (root)/{id} URIs to get a specific category.- Parameters:
id
-- Returns:
-
deleteCategory
@DELETE @Path("{id}") public javax.ws.rs.core.Response deleteCategory(@PathParam("id") int id)
This method responds to DELETE method calls to (root)/{id} URIs to delete a specific category.- Parameters:
id
-- Returns:
-
-