I have existing blazeDS web-services which need to be preserved as is for various legacy reasons.
I now have the need to expose the same functional services via a rest api and marshall the previous binary VOs via json.
I want to know if I can somehow use both @RemotingDestination and @RequestMapping at the same time on the same class? Have it cater to both request types?
Thanks
The easiest way to expose the same functionality to both REST and Blaze is to create a wrapper methods for the REST endpoint and have it proxy through to the original Blaze exposed method.
Simple Example assuming a simple GET:
@Service("userService")
@RemotingDestination(channels={"my-amf","my-secure-amf"})
public class UserService {
@RemotingExclude
@RequestMapping("/user/{id}", method=RequestMethod.GET)
public String getUserByIdRest(@PathVariable String id) {
return this.getUserById(id);
}
@RemotingInclude
public String getUserById(String id) {
//..
return id;
}
}