The event handlers that you will produce for remote interaction are exactly the same as your other handlers, with the exception that they have a return type and return data back to the caller; our proxies. Then our proxies can strong type the return data elements:
Handler:
Hint The request context has a method called
isProxyRequest()
which tells the application if the request is coming from a ColdBox proxy.
Proxy:
Now, what if you want to distinguish between a normal request and a proxy request? Well, the request context object, most commonly known as the event object has a method called:
isProxyRequest
: This boolean method determines what type of request is being executed.
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:
Proxy:
This handler can now respond to HTML requests, SOAP requests, Flex/Air Requests and even RESTFul requests. How about that!