You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Pardeike <ap...@fsys.se> on 2009/03/16 16:01:07 UTC

How to get a page's html to send it as an email?

Hi,

I build it so my users can customize their tapestry pages. Now I
want to add that they can send html emails by using the output of
a specific page. How do I grab the outcome of a page for further
processing?

Regards,
Andreas Pardeike

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


Re: How to get a page's html to send it as an email?

Posted by trsvax <tr...@gmail.com>.
I just use 

InputStream is = new URL("tapestry url").openStream().

This works for pretty much anything. If you need more control the URL class
has methods for setting headers etc.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-get-a-page-s-html-to-send-it-as-an-email-tp2399000p5714815.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: How to get a page's html to send it as an email?

Posted by Lance Java <la...@googlemail.com>.
Sorry... forgot to mention that this is a very general approach and there is
probably a tapestry way to do it.

2009/3/17 Andreas Pardeike <ap...@fsys.se>

> On 16 mar 2009, at 16.34, Lance Java wrote:
>
>  DWR does this by forwarding to the URL passing a response object that
>> writes to a local stringbuffer.
>> See the attached files, the method is DefaultWebContext.forwardToString();
>>
>
> Thanks for sharing the code with me. However, I wonder if there is a more
> build-in way of getting
> a T5 page to render into a string without simulating an external http
> request. Something that would
> even work with a component.
>
> Anyone?
>
> Andreas Pardeike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: How to get a page's html to send it as an email?

Posted by luna_guo <gh...@163.com>.


Andreas Pardeike-2 wrote:
> 
> On 17 mar 2009, at 10.06, luna_guo wrote:
> 
>> Is this what you want?
>>
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageDocumentGenerator.html
> 
> Yes! Works very well. Two minor questions remain:
> 
> 1) Can this be done with an activation context or another way to  
> parameterize the page?
> 
> 2) Can this be done with a component instead of a page?
> 
> For (1) I can set some values in my session and render the page right  
> after that. Seems
> a bit like a hack though.
> 
> /Andreas Pardeike
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


1)In the first version of this service(t5.0.14?),you must save the activate
context to a @Persist property. In Tapestry 5.1.0,i did a little test.It
works well without this problem.
2)Yes,but if you use it in a render lifecycle method.You cannot ask the page
which include this component.Because it will indirectly  call itself.


luna
-- 
View this message in context: http://www.nabble.com/How-to-get-a-page%27s-html-to-send-it-as-an-email--tp22540106p22571265.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: How to get a page's html to send it as an email?

Posted by arterzatij <ar...@gmail.com>.
Hi Luna,


luna_guo wrote
> 
> 
> 
> 1)In the first version of this service(t5.0.14?),you must save the
> activate context to a @Persist property. In Tapestry 5.1.0,i did a little
> test.It works well without this problem.
> 
> 
> luna
> 
    How does this can be done? 
    Do you have an example?


Thanks in advance!






--
View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-get-a-page-s-html-to-send-it-as-an-email-tp2399000p5714809.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: How to get a page's html to send it as an email?

Posted by Andreas Pardeike <ap...@fsys.se>.
On 17 mar 2009, at 10.06, luna_guo wrote:

> Is this what you want?
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageDocumentGenerator.html

Yes! Works very well. Two minor questions remain:

1) Can this be done with an activation context or another way to  
parameterize the page?

2) Can this be done with a component instead of a page?

For (1) I can set some values in my session and render the page right  
after that. Seems
a bit like a hack though.

/Andreas Pardeike

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


Re: How to get a page's html to send it as an email?

Posted by luna_guo <gh...@163.com>.
Is this what you
want?http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageDocumentGenerator.html

Andreas Pardeike-2 wrote:
> 
> On 16 mar 2009, at 16.34, Lance Java wrote:
> 
>> DWR does this by forwarding to the URL passing a response object  
>> that writes to a local stringbuffer.
>> See the attached files, the method is  
>> DefaultWebContext.forwardToString();
> 
> Thanks for sharing the code with me. However, I wonder if there is a  
> more build-in way of getting
> a T5 page to render into a string without simulating an external http  
> request. Something that would
> even work with a component.
> 
> Anyone?
> Andreas Pardeike
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-get-a-page%27s-html-to-send-it-as-an-email--tp22540106p22554963.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: How to get a page's html to send it as an email?

Posted by Andreas Pardeike <ap...@fsys.se>.
On 16 mar 2009, at 16.34, Lance Java wrote:

> DWR does this by forwarding to the URL passing a response object  
> that writes to a local stringbuffer.
> See the attached files, the method is  
> DefaultWebContext.forwardToString();

Thanks for sharing the code with me. However, I wonder if there is a  
more build-in way of getting
a T5 page to render into a string without simulating an external http  
request. Something that would
even work with a component.

Anyone?
Andreas Pardeike

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


Re: How to get a page's html to send it as an email?

Posted by Lance Java <la...@googlemail.com>.
DWR does this by forwarding to the URL passing a response object that writes
to a local stringbuffer.
See the attached files, the method is DefaultWebContext.forwardToString();

Cheers,
Lance.

2009/3/16 Andreas Pardeike <ap...@fsys.se>

> Hi,
>
> I build it so my users can customize their tapestry pages. Now I
> want to add that they can send html emails by using the output of
> a specific page. How do I grab the outcome of a page for further
> processing?
>
> Regards,
> Andreas Pardeike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>