[Seaside] Seaside with XML output?

StormByte stormbyte at gmail.com
Thu Aug 17 15:34:34 UTC 2017


Hi again, sorry for the late response.


I ended up subclassing WAApplication because then I can set my desired
rootClass also (and it is already a subclass of WARequestHandler), and
then, in handleFiltered: aRequest, I set a condition to do the XML or
just send super handleFiltered to normally render html.

What is missing to finish the testing is:

Is there anyway I can get the current instance of the root class from
within handleFiltered: method? So far I did only succeed getting the
rootClass with: self preferenceAt: #rootClass


Thank you again.


El 15/08/17 a las 10:58, Philippe Marschall escribió:
> On Mon, Aug 14, 2017 at 9:59 PM, StormByte <stormbyte at gmail.com> wrote:
>> I am trying to use Seaside for output XML on some components (not all),
>> but I am having problems with it, this way, I am trying to create a
>> minimal component which its own purpose is to output generated XML directly.
>>
>> I red the mailing list and found some interesting info, but mainly for
>> output a XML file, or create an XML on the fly to be downloaded via an
>> anchor click, but that is different that what I need, which is to output
>> XML directly (instead of HTML).
>>
>> The best approach seems to be subclassing WARequestHandler, but then,
>> how can I use it inside my new minimal example to play with and test?
>> Like, for example having a method rendererClass returning my own canvas
>> to render.
> I think in your case it's best to take a gradual approach. Here's what
> I would do:
>
> 1. start with subclassing WARequestHandler
>
> handleFiltered: aRequestContext
>     aRequestContext respond: [ :response |
>         response
>             contentType: (WAMimeType main: 'text' sub: 'xml');
>             nextPutAll:  '<xml/>' ]
>
> This returns static XML (you can change it to be XML in your schema).
> This is simply to get you started so you can experiment.
>
> 2. Use Magritte XML or WAXmlCanvas to generate the XML, so you can
> have dynamic XML. There are other options, but these are common ones.
> If you decide to go with WAXmlCanvas
>
> WAXmlCanvas builder
>     documentClass: WAXmlDocument;
>     rootClass: WAXmlRoot;
>     render: [ :xml |
>         xml
>             tag: 'the-tag'
>             with: 'the-content' ]
>
> Then you probably want to implement a custom canvas for your XML
> dialect. Have a look at RRRssRenderCanvas from Seaside-RSS on how to
> do this.
>
> 3. Decide on with component model you want to use. I don't really know
> what your use case is so it's hard to tell. If your building a REST
> interface the obvious choice is Seaside-REST. If you want to go with
> components have a look at RRComponent from Seaside-RSS. It is also
> possible to combine the two approaches, fire up an XML canvas in a
> Seaside-REST request handler and let it render a painter.
> This probably requires some experimentation from your side to figure
> out what fits best your needs.
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20170817/2bbe17d6/attachment.sig>


More information about the seaside mailing list