[Seaside] contentType:

Ramon Leon rleon at insario.com
Wed Jan 4 22:45:03 CET 2006

> > Hi, I notice I can get at the current request from a component by 
> > calling self session currentRequest, but how do I get at 
> the current 
> > response to change the contentType?  Say I want to have a component 
> > render as contentType: 'text/xml', or a component render as
> > contentType:
> > 'application/vnd.ms-excel'?
> Do you really want to have a component render as one of those 
> content types?  Seems more likely that you'll want to 
> generate those responses in some other way... from within a 
> callback, you can use  
> WASession>>returnResponse: to return a WAResponse instance that you
> have built from scratch with whatever content type you like.
> Avi

Well, I think I do, because I still want to use the component to render
my html, but html isn't always just html, it could be interpreted as an
excel table, or an xml file for exporting data, and I don't know how to
take a custom response object and make a component render on it.  I just
want to create a popup in a callback, and send it a component that
simply renders as a different content type.  

If there's some better way I'd be open to it, but it's such a common
technique in other frameworks to simply change the current contentType I
can't imagine it'd be so difficult.  I'm just accustomed, due to
asp.net, to having access to Request, Response, Session and Application
objects, and it only seems the response is missing in Seaside, the rest
I can use as always.

More information about the Seaside mailing list