You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jamie Orchard-Hays <ja...@dang.com> on 2005/03/24 21:15:05 UTC

serving pdfs

Has anyone ever served up a PDF file any other way than through a service?

Jamie

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


Re: serving pdfs

Posted by Markus Wiederkehr <ma...@gmail.com>.
On Thu, 24 Mar 2005 15:15:05 -0500, Jamie Orchard-Hays <ja...@dang.com> wrote:
> Has anyone ever served up a PDF file any other way than through a service?

Just out of curiosity: What's wrong with using a service for this
purpose? IMO it's the ideal solution...

Markus

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


Re: serving pdfs

Posted by Kent Tong <ke...@cpttm.org.mo>.
Paul Ferraro <pmf8 <at> columbia.edu> writes:

> 
> The issue I have with this code is that request execution doesn't 
> magically end when you close the servlet output stream.  The service 
> that triggered your listener will continue to attempt to render the 
> current page.  Even though the end user will not see a difference, I 
> would expect that your server will log an error when it tries to write 
> to a closed output stream.

An option is not to close the stream and let the response
page render. As long as we set the Content-Length, any
extra output will be removed.


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


RE: serving pdfs

Posted by Steven Porter <sp...@yahoo.co.uk>.
> The issue I have with this code is that request execution doesn't
> magically end when you close the servlet output stream.  The service
> that triggered your listener will continue to attempt to render the
> current page.  Even though the end user will not see a difference, I
> would expect that your server will log an error when it tries to write
> to a closed output stream.

We get no errors (which I was surprised about), but I agree...it bothered me
too.  It's for that reason, that we implemented support for "activating a
null page": "cycle.activate((IPage)null);" and extended the engine to ensure
that if a null page was activated, then it handled it nicely.

sp



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


Re: serving pdfs

Posted by Paul Ferraro <pm...@columbia.edu>.
The issue I have with this code is that request execution doesn't 
magically end when you close the servlet output stream.  The service 
that triggered your listener will continue to attempt to render the 
current page.  Even though the end user will not see a difference, I 
would expect that your server will log an error when it tries to write 
to a closed output stream.

Paul

Steven Porter wrote:

>Hi Jamie,
>
>We have served up CSV files (the key being that it's not rendered by a
>page).
>
>One simple solution is to get access to the response output stream from
>within the direct link trigger or form listener, or whevever, and write out
>the PDF directly onto the stream, and then flush the buffer and close the
>stream.
>
>You also need to set the content-type, etc.
>
>This is illustrated in FAQ 2.7:
>
>
>This does not use a service.
>
>
>
>  
>
>>-----Original Message-----
>>From: Jamie Orchard-Hays [mailto:jamie@dang.com]
>>Sent: 24 March 2005 20:15
>>To: Tapestry users
>>Subject: serving pdfs
>>
>>
>>Has anyone ever served up a PDF file any other way than through a service?
>>
>>Jamie
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


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


RE: serving pdfs

Posted by Steven Porter <sp...@yahoo.co.uk>.
Hi Jamie,

We have served up CSV files (the key being that it's not rendered by a
page).

One simple solution is to get access to the response output stream from
within the direct link trigger or form listener, or whevever, and write out
the PDF directly onto the stream, and then flush the buffer and close the
stream.

You also need to set the content-type, etc.

This is illustrated in FAQ 2.7:


This does not use a service.



> -----Original Message-----
> From: Jamie Orchard-Hays [mailto:jamie@dang.com]
> Sent: 24 March 2005 20:15
> To: Tapestry users
> Subject: serving pdfs
>
>
> Has anyone ever served up a PDF file any other way than through a service?
>
> Jamie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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