You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Henrik Hjalmarsson <ha...@hotmail.com> on 2005/04/02 11:13:13 UTC
Forced page rendering to get XML-data
In my quest to render a page content to a string I can access I have tried
the following solution
====Generate.java====
public class Generate extends BasePage
{
private ByteArrayOutputStream stream = new ByteArrayOutputStream();
private IMarkupWriter stringWriter = new HTMLWriter("text/xml", stream);
public IMarkupWriter getResponseWriter(OutputStream o)
{
return new HTMLWriter("text/xml", o);
}
public void renderPage(IMarkupWriter writer, IRequestCycle cycle)
{
super.renderPage(stringWriter, cycle);
HttpServletResponse response =
cycle.getRequestContext().getResponse();
response.setContentType("text/xml");
System.out.println("renderPage GENERATE");
System.out.println("RESPONSE:" + stream.toString() + ":");
writer.printRaw(stream.toString());
stream = new ByteArrayOutputStream();
}
}
====Generate.page====
<page-specification class="se.fyrplus.timetool3.gui.Generate">
<component id="test" type="Insert">
<static-binding name="value" value="TESTING" />
</component>
</page-specification>
====Generate.html====
<Test>
<span jwcid="test"/>
Login kommer här...
</Test>
My output on standardout is "RESPONSE::" that means I get no generated data
from the page. Am I completely off track on how Tapestry works ? Any ideas
?
Thankful for any help.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Forced page rendering to get XML-data
Posted by Henrik Hjalmarsson <ha...@hotmail.com>.
By using Tapestry to generate the data I could re-use an already existing
Java-class for another Tapestry page that displays data for editing instead.
I could then write only a new html-template and page specification.
I have gotten a working solution I think, by using Servlet filter, to
generate a PDF after Tapestry has generated the XML.
>From: Kent Tong <ke...@cpttm.org.mo>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: tapestry-user@jakarta.apache.org
>Subject: Re: Forced page rendering to get XML-data
>Date: Mon, 4 Apr 2005 01:53:45 +0000 (UTC)
>
>Why not generate the XML data using plain old Java without Tapestry?
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Forced page rendering to get XML-data
Posted by Kent Tong <ke...@cpttm.org.mo>.
Why not generate the XML data using plain old Java without Tapestry?
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org