[Seaside] requestContext and extra data in the output
jfitzell at gmail.com
Tue Nov 23 08:18:33 UTC 2010
On Tue, Nov 23, 2010 at 5:32 AM, Philippe Marschall
<philippe.marschall at gmail.com> wrote:
> 2010/11/22 Brian Tabone <brian.tabone at gmail.com>:
>> Long story short, How do I get rid of the <html header data that is in
>> the buffer before I get a hold of the response to put my JSon data in
>> the stream? Should I re-initialize the response with a fresh buffer?
> Nope. You're in the render phase, you should render HTML. If you want
> to return JSON you can do that in the callback phase. If you're
> building a web service you shouldn't use components at all.
I think that's a bit strong. Components are perfectly valid for an
application that returns non-HTML (take the RSS examples). However,
the Application/Session code is all pretty geared around returning
As long as you're using a non-streaming response, you could certainly
clear the contents in the buffer, however Philippe is right that the
normal pattern would be to do this in a callback. You could do
callback: [ self requestContext returnResponse: [ :response | ...
your code here ... ] ];
More information about the seaside