Monday, 28 March 2011

Writing a JSONP codec for openrasta

So it seems Openrasta supports json out of the box, but I needed it to support jsonp - in order to do cross-domain calls.

Stealing the original json codec, I've implemented a jsonp codec, code below.
Really enjoying openrasta so far - very quick to get up and running, simple conventions, and easily extendable !

To use the codec :

ResourceSpace.Has.ResourcesOfType<MyStuff>()
.AtUri("/mystuff")
.HandledBy<MyStuffHandler>()
.TranscodedBy<JsonpDataContractCodec>();

1 comment:

  1. Thanks. I'm going to steel this. Although isn't the default convention for callback "callback" ?

    ReplyDelete