Generating @ResponseBody annotation

14 views
Skip to first unread message

Parul Jain

unread,
Mar 8, 2012, 10:43:45 AM3/8/12
to Fornax-Platform
Hi

We need to generate the @ResponseBody annotation in generated methods
corresponding to our resources and I am trying to figure out how to
alter the model.btdesign to explicitly generate one. Any ideas would
be highly appreciated.

Currently in model.btdesign we have :-

Resource SomeResource {
addUpdateMyInfo(@SomeVo syncInfo) PUT path = "/rest/def/$
{entityId}" => myService.addUpdateMyInfo;
}


Generated SomeResourceBase.java has :-

@RequestMapping(value = "/abc/def/${entityId}", method =
RequestMethod.PUT)
public SomeVo addUpdateMyInfo(@RequestBody SomeVo syncInfo) {
SomeVo result = myService.addUpdateMyInfo(syncInfo);
return result;
}


Thanks
Parul

Patrik Nordwall

unread,
Mar 10, 2012, 9:41:42 AM3/10/12
to fornax-...@googlegroups.com
If its only a few places it's probably easiest to implement those resource methods manually, and add whatever annotations you need. Then you define them like this in model.btdesign:

     Resource SomeResource {
    inject @MyService
    addUpdateMyInfo(@SomeVo syncInfo) PUT path="/rest/def/${entityId}";
    }

If it's a more general thing that you wan't at many places you can probably tweak the generation templates with SpecialCases.xpt as described in the Developer's Guide. The template is tempates/rest/Resource.xpt

/Patrik
Reply all
Reply to author
Forward
0 new messages