On 5/25/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
On Thu, May 25, 2006 2:12 pm, Jason Carreira wrote: > I'm still waiting to see how this plays out... I've been a big proponent > of Dojo and built several Dojo widgets, but I understand that it can be > tricky and not as easy to use as we'd all like. I think there'll be room > for different strategies and implementations, and we'll figure it out as > we go. It's been talked about here, but I don't know how much interest there might be... At this moment I'm grabbing the code I started and intend to finish it this weekend... My plan is to create 4 interceptors. Two for input and two for output, one each for XML and one each for JSON. How I envision it working is that let's say for example you want to send XML to an Action and get JSON back... ok, so you add the (a) AjaxXMLInputInterceptor and (b) AjaxJsonOutputInterceptor to the stack... On input, (a) determines (not quite sure how yet) that the request has XML in the request body. So it gets it, parses it, and sets the fields on the Action as I outlined yesterday.
I would expect a well-behaved client to set the content type on the incoming request to "text/xml" for XML content, so you should be able to check that. Likewise, isn't JSON content supposed to be sent with "text/javascript"? On output, (b) takes the Action and generates JSON from its fields. And you should, of course, set the correct content type on the response too. Craig At least initially, the only added config is the new interceptors. There
are some obvious ways to expand this, and some obvious problems, but for a first pass I think it's enough. I believe this will allow you to make Ajax calls to an Action from any Ajax code, without much of any extra work on your part. It should also allow for XML/JSON responses, at least simplistically, without any extra work. Does this sound reasonable to anyone? I'm going to go ahead and do it in any case as it is my first try at writing an interceptor, and also the first time I'm doing anything that requires even minimal internal knowledge of XW/WW, so it should be a learning experience if nothing else. I may be missing something, but it seems like it might be useful too :) Frank > --------------------------------------------------------------------- > Posted via Jive Forums > http://forums.opensymphony.com/thread.jspa?threadID=32216&messageID=62655#62655 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]