Blake Byrnes wrote:
I dealt with the ajax result discrepency (ie, if you make an ajax request,
you generally want a different result, but probably want to share the same
action) by writing a few things:
1) A sitemesh filter that ignores requests with the content header
X-Requested-With=XMLHttpRequest
Nice idea. I'd been differentiating by extension (xhtml for ajax) which has been getting out-of-hand.
2) An Interceptor and interface for dealing with Ajax requests that allows
you to specify a different result.  The method is called "beforeResult"
allowing you to change it if necessary.
3) A way to ask for views: sharing actions creates extreme complexity if you
have multiple pages that have different results under different contexts
(ie, a get on a resource may return a specific html fragment if it is
requested from a list view, which is different from what should happen if
it's requested from a regular "get" view on the resource).

The REST plugin deals with similar issues through the RestActionMapper, RestActionInvocation and ContentTypeHandler. The first two for invoking the appropriate method and selecting a view and the latter for handling other result types for the same action (xml, json etc). I think the REST plugin takes an excellent approach to this problem but you may be able to apply some lessons learnt to them as well.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to