I've done something like what you are asking in order to generate email
messages. It's not pretty, and not well supported but it can be done...

Here is the guts of the process:

protected String getHtml(String page, String[] context, EmailContext
emailContext) {
        Request request = _requestGlobals.getRequest();
        Response response = _requestGlobals.getResponse();
        // response wrapper stores everything written into a buffer
        EmailResponse emailResponse = new
EmailResponse(_requestGlobals.getHTTPServletResponse());
        _requestGlobals.store(request, emailResponse);
        // email context contains some parameters passed into the rendered
page
        request.getSession(true).setAttribute("emailContext", emailContext);
        // pageRenderRequestHandler clears the environment... remember
things to put back later (fragile)...
        Heartbeat heartbeat = _environment.peek(Heartbeat.class);
        FormSupport formSupport = _environment.peek(FormSupport.class);
        try {
            _pageRenderRequestHandler.handle(page, context);
            return emailResponse.toString();
        } catch (Exception e) {
            _log.warn("Failed to send video external " + e.getMessage());
        } finally {
            // Hope no other env vars are stored :(
            _environment.push(Heartbeat.class, heartbeat);
            _environment.push(FormSupport.class, formSupport);

            // Always restore the response
            _requestGlobals.store(request, response);
            request.getSession(true).setAttribute("emailContext", null);
        }
        return null;
    }
This code is used to generate the html version of all email messages sent by
thedailytube.com

Hope that helps,
Josh




On Dec 3, 2007 8:41 AM, patrick whalen <[EMAIL PROTECTED]> wrote:

>
> Could anyone give me any pointers or directions on how to stream the html
> output that Tapestry generates out to a text file, which would be stored
> in
> a specific directory outside the Tapestry project?
>
> I would also like to be able to do the same with assets such as css and
> javascript files, though this would be less important, and more of a
> convenience.
>
> Any hints and suggestions are appreciated.
>
> Thanks much.    patrick
> --
> View this message in context:
> http://www.nabble.com/T5---Stream-source-output-to-text-file-tf4937616.html#a14133292
> Sent from the Tapestry - User mailing list archive at 
> Nabble.com<http://nabble.com/>
> .
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to