@Path("/{eshopId:\\d+}/product/")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response createProduct(@Context UriInfo uriInfo, @PathParam("eshopId") Long eshopId, ProductDTO productDTO) {
try {
ProductDTO product = productService.create(uriInfo, eshopId, productDTO);
return Response.status(Response.Status.CREATED)
.header("Location", product.getUri()).build();
} catch (NotExistingEntityException ex) {
throw new NotFoundException(ex.getMessage());
}
}