T5: stream binary files

View: New views
4 Messages — Rating Filter:   Alert me  

T5: stream binary files

by Chris Lewis-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm curious if there is a common way to stream binary files like images,
PDFs, etc. I've read
http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
and understand that method, but something just feels wrong about using a
page for this kind of operation (after all, it's not a page). Has anyone
take a non-page approach to this? Thanks for any input.

chris

--
http://thegodcode.net


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


Re: T5: stream binary files

by kristian.marinkovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi chris,

instead of having the page return a StreamResponse you
could a define a ComponentEventResultProcessor that will
convert the result of a component event into a StreamResponse
transparently

eg.

Document onSubmit() {
   return new Document("path/file.pdf");
}

registered service:

Document.class,new ComponentEventResultProcessor<Document>() {
...
    public void processResultValue(final Document value) throws
IOException
    {
        // create a streamresponse and return via the
StreamResponseResultProcessor service
    }
}

hope this is somehow useful to you...

after thinking twice you could also add a Dispatcher that returns your
binaries
directly....

g,
kris




Chris Lewis <chris_lewis@...>
23.07.2008 13:02
Bitte antworten an
"Tapestry users" <users@...>


An
Tapestry users <users@...>
Kopie

Thema
T5: stream binary files







Hello,

I'm curious if there is a common way to stream binary files like images,
PDFs, etc. I've read
http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
and understand that method, but something just feels wrong about using a
page for this kind of operation (after all, it's not a page). Has anyone
take a non-page approach to this? Thanks for any input.

chris

--
http://thegodcode.net


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



RE: T5: stream binary files

by Jonathan Barker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It takes some getting used to, but it just removes the need to create a
service as in T4.  Your page is a service.



> -----Original Message-----
> From: Chris Lewis [mailto:chris_lewis@...]
> Sent: Wednesday, July 23, 2008 07:03
> To: Tapestry users
> Subject: T5: stream binary files
>
> Hello,
>
> I'm curious if there is a common way to stream binary files like images,
> PDFs, etc. I've read
> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
> and understand that method, but something just feels wrong about using a
> page for this kind of operation (after all, it's not a page). Has anyone
> take a non-page approach to this? Thanks for any input.
>
> chris
>
> --
> http://thegodcode.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


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


Re: T5: stream binary files

by Chris Lewis-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Kristian - I've messed with dispatchers a bit and am playing with
that route. Now I've run into an interesting hibernate session issue,
but that's for a new thread :-)

thanks for your input

chris

Kristian Marinkovic wrote:

> hi chris,
>
> instead of having the page return a StreamResponse you
> could a define a ComponentEventResultProcessor that will
> convert the result of a component event into a StreamResponse
> transparently
>
> eg.
>
> Document onSubmit() {
>    return new Document("path/file.pdf");
> }
>
> registered service:
>
> Document.class,new ComponentEventResultProcessor<Document>() {
> ...
>     public void processResultValue(final Document value) throws
> IOException
>     {
>         // create a streamresponse and return via the
> StreamResponseResultProcessor service
>     }
> }
>
> hope this is somehow useful to you...
>
> after thinking twice you could also add a Dispatcher that returns your
> binaries
> directly....
>
> g,
> kris
>
>
>
>
> Chris Lewis <chris_lewis@...>
> 23.07.2008 13:02
> Bitte antworten an
> "Tapestry users" <users@...>
>
>
> An
> Tapestry users <users@...>
> Kopie
>
> Thema
> T5: stream binary files
>
>
>
>
>
>
>
> Hello,
>
> I'm curious if there is a common way to stream binary files like images,
> PDFs, etc. I've read
> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
> and understand that method, but something just feels wrong about using a
> page for this kind of operation (after all, it's not a page). Has anyone
> take a non-page approach to this? Thanks for any input.
>
> chris
>
>  

--
http://thegodcode.net


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