You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephane Decleire <sd...@cariboo-networks.com> on 2006/09/19 12:23:20 UTC

How to send or save into a file a tapestry page

Hi all,

I would like to send or save the HTML content generated by a page. The 
idea is to mail our team (perhaps by a SMTPAppender in log4j) the 
Tapestry exception page while showing the user a nice message when an 
error occured on our website.

I've found on the web the solution below but it's for Tap3 and it looks 
like a bit tricky ...
Any idea or help would be welcome.

Thanks in advance.

-- 
Stéphane Decleire



Re: How to send or save into a file a tapestry page

Posted by Hajaansh <ha...@googlemail.com>.
By the way is this possible without having a http request (or cycle)? Would
you then need to generate a cycle object?

Cheers,



> On 9/19/06, Stephane Decleire <sdecleire@cariboo-networks.com > wrote:
> >
> > Here it is :
> >
> >
> > http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200503.mbox/%3CLPBBKGGOONHIEPFBJFKEEENCFHAA.shawn@boxity.com%3E
> >
> > -------------------------
> >
> > Assuming you are already familiar with the Javamail API, it sounds like
> > all
> > you really need is the Tapestry-rendered data stream.  This is actually
> > really easy:
> >
> > EmailPage next = (EmailPage) cycle.getPage("EmailPage");
> > next.setSomeProperty(getSomeProperty());
> >
> > ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > HTMLWriter writer = new HTMLWriter(baos);
> > cycle.activate(next);
> > cycle.renderPage(writer);
> > writer.flush();
> >
> > You can then do whatever you want with baos.  I can give you more
> > details if
> > you would like.
> >
> > Shawn
> >
> > -------------------------
> >
> >
> >
> > Peter Dawn a écrit :
> > > can you share the link/info for implementing this in tap3
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> >
> > --
> > Stéphane Decleire
> >
> > 05 56 57 99 20
> > 06 63 78 69 06
> >
> >
> >
>

Re: How to send or save into a file a tapestry page

Posted by Hajaansh <ha...@googlemail.com>.
Perfect! I needed this too! Cheers!

On 9/19/06, Stephane Decleire <sd...@cariboo-networks.com> wrote:
>
> Here it is :
>
>
> http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200503.mbox/%3CLPBBKGGOONHIEPFBJFKEEENCFHAA.shawn@boxity.com%3E
>
> -------------------------
>
> Assuming you are already familiar with the Javamail API, it sounds like
> all
> you really need is the Tapestry-rendered data stream.  This is actually
> really easy:
>
> EmailPage next = (EmailPage) cycle.getPage("EmailPage");
> next.setSomeProperty(getSomeProperty());
>
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> HTMLWriter writer = new HTMLWriter(baos);
> cycle.activate(next);
> cycle.renderPage(writer);
> writer.flush();
>
> You can then do whatever you want with baos.  I can give you more details
> if
> you would like.
>
> Shawn
>
> -------------------------
>
>
>
> Peter Dawn a écrit :
> > can you share the link/info for implementing this in tap3
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> --
> Stéphane Decleire
>
> 05 56 57 99 20
> 06 63 78 69 06
>
>
>

Re: How to send or save into a file a tapestry page

Posted by Stephane Decleire <sd...@cariboo-networks.com>.
Here it is :

http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200503.mbox/%3CLPBBKGGOONHIEPFBJFKEEENCFHAA.shawn@boxity.com%3E

-------------------------

Assuming you are already familiar with the Javamail API, it sounds like all
you really need is the Tapestry-rendered data stream.  This is actually
really easy:

EmailPage next = (EmailPage) cycle.getPage("EmailPage");
next.setSomeProperty(getSomeProperty());

ByteArrayOutputStream baos = new ByteArrayOutputStream();
HTMLWriter writer = new HTMLWriter(baos);
cycle.activate(next);
cycle.renderPage(writer);
writer.flush();

You can then do whatever you want with baos.  I can give you more details if
you would like.

Shawn

-------------------------



Peter Dawn a écrit :
> can you share the link/info for implementing this in tap3
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

-- 
Stéphane Decleire

05 56 57 99 20
06 63 78 69 06


Re: How to send or save into a file a tapestry page

Posted by Peter Dawn <pe...@gmail.com>.
can you share the link/info for implementing this in tap3

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org