Hi Patrik,
How would you image this one in the dsl as annotated?
I mean how should it look in the textual language?
The problem ist that operations and params need "annotations" there.
Could you give me an example?
@RequestMapping(value = "/inquiry/{id}", method = RequestMethod.GET)
public String show(@PathVariable("id") Long id, ModelMap modelMap)
throws InquiryNotFoundException
Thanks
attila
Patrik Nordwall wrote:
>
> Hi all, I have an idea of a new feature and would like to have your input.
>
> When we have evaluated Google App Engine we have used the new REST
> features in Spring 3.0. REST is a perfect style for the cloud and I think
> it would be rather easy to generate the Spring Controllers, delegating to
> Services. I'm not looking for another gui solution. It should primarily
> support json and xml content, which can be used by various client
> applications (not only cloud environment).
>
> My suggestion is to generate Spring Controllers with @RequestMapping
> annotations. The methods should delegate to Service methods, or be
> implemented by hand written code in gap subclass.
>
> It might look something like this:
>
> @RequestMapping(value = "/inquiry/{id}", method = RequestMethod.GET)
> public String show(@PathVariable("id") Long id, ModelMap modelMap)
> throws InquiryNotFoundException {
> Key inquiryKey =
> KeyFactory.createKey(Inquiry.class.getSimpleName(), id);
> Inquiry inquiry = inquiryService.findById(serviceContext(),
> inquiryKey);
> modelMap.put("inquiry", inquiry);
> return "inquiry/show";
> }
>
> @RequestMapping(value = "/inquiry", method = RequestMethod.POST)
> public String create(@ModelAttribute("inquiry") Inquiry inquiry,
> BindingResult result) {
> if (inquiry == null) {
> throw new IllegalArgumentException("A inquiry is required");
> }
> Inquiry savedInquiry = inquiryService.save(serviceContext(),
> inquiry);
> return "redirect:/rest/inquiry/" + savedInquiry.getId().getId();
> }
>
>
> What I think should be done:
> - In meta model add Controller and ControllerOperation, similar to
> Service. ControllerOperation should include things necessary to define
> RequestMapping and delegation to ServiceOperation.
> - In DSL add DslController similar to DslService
> - In transformation add transformaton from DslController to Controller
> - In transformation add scaffold for controller, similar to Service, i.e.
> the CRUD operations can be automated using single scaffold keyword
> - Generation template for Controller and its operations. Support for gap
> class.
> - Generation template for spring configuration for
> ContentNegotiatingViewResolver
>
> References:
> - http://www.infoq.com/articles/designing-restful-http-apps-roth
> - http://blog.springsource.com/2009/03/08/rest-in-spring-3-mvc
> -
> http://stsmedia.net/spring-finance-part-7-adding-support-for-json-and-xml-views/
> http://code.google.com/p/spring-finance-manager/source/checkout
> I have tried the setup described here and I think it is working.
> - http://curl.haxx.se/ (useful for testing)
>
> What do you thing? Would this be useful for you?
>
> /Patrik
>
>
>
--
View this message in context:
http://old.nabble.com/-sculptor--RESTful-Services-tp25407858s17564p29489108.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer