[Seaside] Rendering page as XML or JSON?

Michael Lucas-Smith mlucas-smith at cincom.com
Thu Apr 17 20:52:15 UTC 2008


> self session currentRequest at: #beXml ifPresent: [ : it | 
>     self session returnResponse: 
>         (WAResponse new
>             contentType: 'text/xml' ;
>             contents: someObject sixxString readStream ;
>             yourself)]
>   
If you make your own WACanvas subclass too you can do something like this:

    response := Seaside.WAResponse new.
    response contentType: 'application/atom+xml'.
    response nextPutAll: '<?xml version="1.0" encoding="utf-8"?>'.
    atom := SeasideAtom.AtomCanvas new.
    atom context: html context.
    html context document stream: response stream.
    ... do stuff with our new atom canvas ...
    self session returnResponse: response.



More information about the seaside mailing list