Re: Seaside with XML output?
StormByte <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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 > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [email protected] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE4Mt0MZxWFs9CRGrAIW33jMjGTdkFAlmVt44ACgkQIW33jMjG TdmnRA//SANpDUOd2o92FHRfmR8DMvLlxzsl7X1fHxsoEVEZG2sr2nh6hOEiN2Gm fui54ZACWLYAeMtJXs22CWKUMIMJ+yhL2wFQduIhfZUzooNE3C1MKjIBwJyBXAAG yxOV/WA8ZCU1pVHOGBWY8ZVUqBMJ8B5ca1hoFBrKU1qj1PVVcWpqvTVyoLkEyGnX bctV7TB100nz3INKESec4atY+gfbtwR+IzmekmhbmqQAxIPolMJGX7YXs3pYSXEN tHCHkurvXSfOsA41B52x9x/s6x0QxubGkzCOAfqCyFPAP3Vvdv60p9rDSioDj5h8 Mxp4+9/X1GjLhYYcKagdwkr4dPrEFr7lR9V2453BW1dbYKy4RJ2AMunbLO/D5J7o vNhDPj6by9oU6EkkCVNkrtXlj0hIcrxdVEvYhTCZCLLbr/1TxrgbfQgdb3vy/SJy VrfFIjozTlrrV9IIj51GPS08plGGDZlAcx/Q4RF+OBdhhIkTMF5VOV9QQm54jPd3 dEa9Aae8I5hweY4kI1O+aReVSxLEtY/l01eQmnYg001R7NLmLuirf6U/yyKAl+rF LP7Poi0Wr7q9BuoQuD38GY0tGaHpK85FxKKU55YddPRnt+ct+EFxEttKh7KZqbJp OzFymxkJOcwDC6wT0DAUkdozpeoj9tTGVQ0ga7Ut1fmnfabCkvA= =n8ST -----END PGP SIGNATURE-----