Yes you can output XML directly from the template with some caveats.

1) By default the contentType is "text/html", if you want to change that you can override it by using this annotation on your page class file:
@Meta("tapestry.response-content-type=text/xml")

2) namespaces are totally ignored and stripped out.

3) if you use any of the special html elements, then it uses the old html method of not actually closing the tags ( <br>, <img>, etc ). So essentially it outputs invalid xml. You might have to do some post processing to clean it up..


possible work around:

If you need namespaces, or if you need to avoid the "special html tag" handling, you need to look at JIRA issue TAPESTRY-1600. Go there and vote on the bug, it also has a patch if you're stuck and feeling adventurous. I have been using the patch for over a month on production, and have gotten response from another person that they are pretty happy with it.

Go vote for it, for some reason we have gotten zero response from the T5 developers on reviewing the patch. If applying the patch is too much for you and there is still interest, maybe I'll have to maintain a tapestry build with the patch applied..





llonely wrote:
Many thanks Thiago,
this is surprisingly helpful!

Is XML output possible on template level? Having a template with the basic
structure and update it based on parameter values.

BR




Thiago H de Paula Figueiredo-2 wrote:
On Wed, 31 Oct 2007 09:22:47 -0200, llonely <[EMAIL PROTECTED]> wrote:

Hi all,

I am currently testing tapestry and trying to convert a simple servlet.

I have a typical servlet that gets parameters and returns xml
Generate the XML output using any method you fancy and then return a StreamResponse (in this case, a TextStreamResponse) in your onActivate method. Tapestry 5 will not issue a redirect as it does with normal pages. One example is in Howard's blog: http://tapestryjava.blogspot.com/2007/08/handling-direct-urls-in-tapestry-5.html. :)

In previous versions this kind of situation was hard to implement, but in Tapestry 5 it's a piece of cake. :)

--
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to