[Seaside] contentType:

Michel Bany m.bany at wanadoo.fr
Wed Jan 4 23:13:46 CET 2006

Have a look to Seaside2.5b8-mb.34 and Seaside2.6a1-mb.75,
.i.e. the packages I have been recently using for the VW 7.4 port.
See the details below. You may want to integrate these changes into 2.6a2
With these changes you just need to subclass WASession and re-implement 
You can even control the encoding.

WAResponse >> initialize
    | session |
    stream := SeasidePlatformSupport readWriteStream.
    status := '200'.
    session := WACurrentSession value.
    contentType := session isNil
                ifFalse: [session contentType]
                ifTrue: [self defaultValueForContentType]

WAResponse >> defaultValueForContentType
    ^'text/html; charset=utf-8'

WASession >> contentType
    ^'text/html; charset=utf-8'.


Ramon Leon a écrit :

>>>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
>>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.
>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.
>Seaside mailing list
>Seaside at lists.squeakfoundation.org

More information about the Seaside mailing list