re-using existing event handlers with coldbox proxy

While i am designing my web application (which will be a non-ajax,
server side application), i was thinking that it would be good if i
could easily change certain server side views to client side views.

So it would be good if i can call the same event handler remote.

I was thinking this could be possible by just adding a <cfreturn

or <cfreturn rc> at the end of every method in the event

handler. This would basically make te event data available to views
(default), but now also to remote clients because of the cfreturn....

I cant find any information on this through google, can anybody tell
me if this would work? The Event object is a CFC, so would returning a
cfc throw an exception? If yes, maybe a good way would be to get a
memento from the event object and return this instead?

The idea is basically that i only have to create the event hanlder
once, and not a separate one for remote usage. And that i can mix
client and server side this way.


You can do this just like you said. Add a return type to the handler method and return what you want. However, you need to call the coldbox proxy and not the event handler cfc directly. Look at the proxy docs and samples.

You basically call the process() method on the coldboxproxy and tell it which event to execute remotely. It will then return to you whatever the handler method returns.