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://www.nabble.com/-sculptor--RESTful-Services-tp25407858s17564p25407858.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to