Hi there.
I lately tried to generate a RESTful backend with Roo by using the web mvc json mechanism.
It seems to me, that the generated controllers don't really stick to the RESTful good practices.Code:json all web mvc json setup web mvc json all --package ~.controller
For example an update request should be called with an URL like host/application/books/1 using HTTP PUT and giving the changed json object in the request.
Unfortunately the created update method looks like this:
This fits to a URL like host/applikation/books with HTTP PUT.Code:@RequestMapping(method = RequestMethod.PUT, headers = "Accept=application/json") public ResponseEntity<String> BookController.updateFromJson(@RequestBody String json)
Even worse: The showJson method matches perfectly to the REST update request and isn't limited to HTTP GET. With that for every REST update request actually the showJson method is called instead of the updateFromJson method.
There are also other deviations like the missing resource links in the response of update and create methods.
All this makes using client side REST frameworks like AngularJS ngResource almost impossible.
I'm not sure if this is a bug in Roo's json-addon or it is so by purpose. Alternatively a rest-addon would be helpful that creates proper RESTful controllers.


Reply With Quote
