Bill Stilwell wrote:
The bit I'm having trouble figuring out is how the action would
> know that the model should be a SyndFeed object - is there a
> standard way to detect what extension was used when calling
the action? (I could parse it from request.getRequestURI(), but that
seems a bit ugly).

The action doesn't need to know; that's the point. The framework serializes the action based on the content type handler (CTH) registered to the URL extension.

For example, the json extension uses a JSON serializer which will serialize the entire action, or if it implemented ModelDriven just the model. The action code doesn't care that it will be serialized as JSON, it just goes about its business.

In your case you'd construct the SyndFeed object in the content type handler. Actions are intended to create known data to hand off to the view layer--you shouldn't need to convert *any* old objects to your desired output, you just need to convert the object(s) your action creates/retrieves/etc.

It's possible the existing XML CTH would be enough, if you create the appropriate beans. The existing non-RESTful XSLT result type might even be enough if you just write the XSLT to take whatever objects you create and mudge them into the desired format.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to