You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Trunick <Jo...@SmartPrice.com> on 2003/04/15 21:24:29 UTC

"Short-circuit" Tapestry

Is there a way to ask a page to render itself, without have a
RequestContext, or Engine? I'm interested in possibly sending html emails
with generation done by Tapestry. Possible? Already been done?

Joel

RE: "Short-circuit" Tapestry

Posted by Adam Greene <ag...@romulin.com>.
I created a component that is a cross between the renderBlock and javax.mail
that wraps a block of HTML (including Tapestry dynamic stuff) and takes a
collection of Strings for the address to send to.  So when the page is
rendered it sends emails.  Is this of any use??

-----Original Message-----
From: joe panico [mailto:joe@panmachine.biz]
Sent: Wednesday, April 16, 2003 8:11 AM
To: Tapestry users; 'Tapestry users'
Subject: Re: "Short-circuit" Tapestry



> RequestContext, or Engine? I'm interested in possibly sending html emails
> with generation done by Tapestry. Possible? Already been done?

I can think of a couple of approaches.

Probably the most straightforward approach is to simply use an
HttpUrlConnection back onto the application. You can write a trivial Service
that will store a page and its state under a unique key, retrieve the
state-loaded page under that key when the Service URL comes in, and then
service the request just like the ExternalPage service. Provided that you
are
sure you can build an URL to the application that is valid from the hosting
system (I guess the loopback address plus the port should always work?),
this
should work.

A more elegant, and less straightforward approach, might be to use the
various
Mock Objects that Tapestry uses for unit testing. Conceptually, these Mock
objects allow you to short circuit some of the Tapestry machinery in order
to
generate page responses without the overhead of full-bore HTTPConnections.
Of
course the devil is in the details. I don't have enough familiarity with the
Mock objects to know how easy, or clean this would be. But it sounds like it
ought to work.

I would be interested to know what solution you finally settle on.

regards,

joe

--
Open WebMail Project (http://openwebmail.org)


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


Re: "Short-circuit" Tapestry

Posted by joe panico <jo...@panmachine.biz>.
> RequestContext, or Engine? I'm interested in possibly sending html emails
> with generation done by Tapestry. Possible? Already been done?

I can think of a couple of approaches.

Probably the most straightforward approach is to simply use an
HttpUrlConnection back onto the application. You can write a trivial Service
that will store a page and its state under a unique key, retrieve the
state-loaded page under that key when the Service URL comes in, and then
service the request just like the ExternalPage service. Provided that you are
sure you can build an URL to the application that is valid from the hosting
system (I guess the loopback address plus the port should always work?), this
should work.

A more elegant, and less straightforward approach, might be to use the various
Mock Objects that Tapestry uses for unit testing. Conceptually, these Mock
objects allow you to short circuit some of the Tapestry machinery in order to 
generate page responses without the overhead of full-bore HTTPConnections. Of
course the devil is in the details. I don't have enough familiarity with the
Mock objects to know how easy, or clean this would be. But it sounds like it
ought to work.

I would be interested to know what solution you finally settle on.

regards,

joe

--
Open WebMail Project (http://openwebmail.org)


RE: "Short-circuit" Tapestry

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
I think some folks have made some moves in that direction, but its not the
intent of the framework.  You probably aren't going to get by without the
engine and you can kludge up a bit because everything is hidden behind
interfaces.  There comes a time when you have to choose the right tool for
the job; Tapestry may not be the right tool here; I suspect Velocity is a
better choice.

It should be easier to have a Tapestry application render a page into a
StringBuffer (perhaps) that can then be passed to some kind of Mail object
for e-mailing.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Joel Trunick [mailto:Joel@SmartPrice.com] 
> Sent: Tuesday, April 15, 2003 3:24 PM
> To: 'Tapestry users'
> Subject: "Short-circuit" Tapestry
> 
> 
> 
> Is there a way to ask a page to render itself, without have a 
> RequestContext, or Engine? I'm interested in possibly sending 
> html emails with generation done by Tapestry. Possible? 
> Already been done?
> 
> Joel
>