Modifier and Type | Field and Description |
---|---|
private InventoryMgmtEJB |
ejb |
private static org.apache.commons.logging.Log |
log |
private Request |
request |
private UriInfo |
uriInfo |
Constructor and Description |
---|
ProductsResource() |
Modifier and Type | Method and Description |
---|---|
Response |
createProduct(String name,
Integer quantity,
Double price,
String category)
Creates a product
|
Response |
deleteProduct(int id)
Deletes the product identified.
|
Response |
findProductsByName(String name,
int offset,
int limit)
Returns a simple list of products that match provided name
|
Response |
getProduct(int id)
Returns a specific product
|
Response |
updateProduct(int id,
Product product)
Updates a product with the values of the object passed in
|
private static final org.apache.commons.logging.Log log
@Inject private InventoryMgmtEJB ejb
@POST @Path(value="") @Consumes(value="application/x-www-form-urlencoded") @Produces(value="application/xml") public Response createProduct(@FormParam(value="name") String name, @FormParam(value="quantity") Integer quantity, @FormParam(value="price") Double price, @FormParam(value="category") String category)
product
- category
- @GET @Path(value="{id}") @Produces(value="application/xml") public Response getProduct(@PathParam(value="id") int id)
id
- @PUT @Path(value="{id}") @Consumes(value="application/xml") @Produces(value="application/xml") public Response updateProduct(@PathParam(value="id") int id, Product product)
id
- product
- @DELETE @Path(value="{id}") public Response deleteProduct(@PathParam(value="id") int id)
id
- @GET @Path(value="") @Produces(value="application/xml") public Response findProductsByName(@QueryParam(value="name") String name, @QueryParam(value="offset") @DefaultValue(value="0") int offset, @QueryParam(value="limit") @DefaultValue(value="0") int limit)
name
- Copyright © 2015 John's Hopkins University, Engineering Programs for Professionals. All rights reserved.