Re: Non-HTML Views
On Mon, 23 Jul 2012 18:44:23 -0300, Richard Frovarp wrote: http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile http://wiki.apache.org/tapestry/Tapestry5HowToCreateADynamicPDF This idea works for anything you may want to return that isn't an HTML page. This is correct, but it will work for any kind of response, even HTML (probably when it's stored and/or genenerated outside a Tapestry template, such as a database, filesystem or other templating engines). In addition, don't forget that any XML document can be generated and returned in Tapestry templates. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Non-HTML Views
Thanks, Thiago, Richard. Looking into chaining streamed responses. Probably same approach will work to capture the HTML generated (as String) and feed into flying saucer http://www.avajava.com/tutorials/lessons/how-do-i-convert-a-web-page-to-a-string.html How do I convert a web page to a String? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Non-HTML-Views-tp5714731p5714743.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Non-HTML Views
On Mon, 23 Jul 2012 18:07:12 -0300, netdawg wrote: Is there a way now to render non-HTML views? It depends. The output is XML, just make your template generate the XML format you need. Otherwise, return a StreamResponse in onActivate() or an event handler method. Examples: 1. Have the grid component wrap Apache POI to dynamically generate spreadsheets? Aren't you asking to generate spreadsheets from a Grid to Apache POI? Grid wrapping Apache POI doesn't make much sense the way you described it. Just get the date you pass to Grid (either as GridDataSource or Collection) and pass to Apache POI, generate the spreadsheet and return it wrapped in a StreamResponse. 2. Similar PDF engine to generate a pure PDF document (or convert the rendered HTML into PDF a la joomla, drupal CMS etc)? To generate PDF documents in Java, you can use JasperReports or iText (JasperReports uses iText internally). To convert rendered HTML into PDF, first you have to get the rendered HTML. I don't know how to do that, but I recall this having been discussed in the mailing list already. After that, you can use an HTML renderer like Flying Saucer (http://code.google.com/p/flying-saucer/) to transform it into PDF, wrap the PDF in a StreamResponse and return it. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Non-HTML Views
On 07/23/2012 04:07 PM, netdawg wrote: Is there a way now to render non-HTML views? Examples: 1. Have the grid component wrap Apache POI to dynamically generate spreadsheets? 2. Similar PDF engine to generate a pure PDF document (or convert the rendered HTML into PDF a la joomla, drupal CMS etc)? Much Thanks. You need to return a StreamResponse in onSubmit() or similar. http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile http://wiki.apache.org/tapestry/Tapestry5HowToCreateADynamicPDF This idea works for anything you may want to return that isn't an HTML page. You still need the page class file, but you do not need a .tml file. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org