I follow this guide to learn some REST services and AJAX calls: http://www.mkyong.com/webservices/jax-rs/integrate-jackson-with-resteasy/
I changed this endpoint:
@GET @Path("/get") @Produces("application/json") public Product getProductInJSON() { Product product = new Product(); product.setName("iPad 3"); product.setQty(999); return product; }
To return the product in jsonp format:
@GET @Path("/get?callback={name}") @Produces("application/javascript") public String getProductInJSON(@PathParam("name") String callback){ Product product = new Product(); product.setName("iPad 3"); product.setQty(999); String productString = callback + "({" + product.toString() + "})"; return productString; }
with toString () of the product:
@Override public String toString() { return "name:" + name + "," + "qty:" + qty; }
But now, when I check that the URI works in the browser, with:
http: // localhost: 8080 / restws / json / product / get? callback = process
I have this error message:
HTTP ERROR: 404
Could not find resource for relative: / json / product / get full path: http: // localhost: 8080 / restws / json / product / get? Callback = process
RequestURI = / restws / JSON / product / we receive
Can someone help me understand why he gave me this error after this minor change? Thanks
java json rest
DaJackal Aug 18 '11 at 20:14 2011-08-18 20:14
source share