RenderData()
The ColdBox Proxy also has the ability to use the request context's renderData() method. So you can build a system that just uses this functionality to transform data into multiple requests. Even have the ability for the same handler to respond to REST/SOAP and MVC all in one method:
Event Handler:
1
function list(event,rc,prc){
2
prc.users = userService.list();
3
event.renderData( data=prc.users, formats="xml,json,html" );
4
}
Copied!
Proxy:
1
string function getUsers(string format="json"){
2
arguments.event = "users.list";
3
return process(argumentCollection=arguments);
4
}
Copied!
This handler can now respond to HTML requests, SOAP requests, Flex/Air Requests and even RESTFul requests. How about that!
Last modified 3yr ago
Copy link
Edit on GitHub