You need to connect the dots between what you have and what the browser needs.

What you have is BufferedImage object.

What the browser needs is a URL.  When it uses HTTP GET on that URL,
it needs a stream of bytes.

You can't just return the BufferedImage object; there's no realistic
way that Tapestry could magically know how to create a URL directly
from that, and serve up the correct bytestream.

What you can do is create a URL that calls back into your page.  You
then can use the BufferedImage to generate that stream of bytes.

Tapestry's ComponentResources.createEventLink() method allows you to
create a callback URL.

Tapestry will invoke a method when the browser GETs that URL; the
method can return Tapestry's StreamResponse type, which is what will
provide the stream of bytes to go to the browser.

It is an explicit aspect of developing web applications with Tapestry
that you must have at least a cursory knowledge of how HTTP and
servlets and the like work;  Tapestry handles virtually all the busy
work for you, and hides lots and lots of details and edge cases you'd
rather not know about ... but it is explicitly a layer on top of HTTP
and Java servlets.

On Tue, Jul 17, 2012 at 1:33 PM, gonzalomp87 <gonzalom...@gmail.com> wrote:
> Sorry, I dont understand.
>
> I have a BufferedImage type variable in my .tml can not show, but I can
> convert into a variable of type InputStream.
> Suppose I call that variable myImage
>
> I was looking at that page but do not quite understand. I'm supposed to use
> the last paragraph "Creating a page for streaming files" but I have some
> questions.
>
> 1. function getuploadfile should  return  Link instead of a string?
> 2. I do not understand that I would have to put in the variable "final
> String uuid" or in this call ".... getUploadedFile (" SOMEUUID ")"
> 3. At these points would have to enter some code? return new StreamResponse
> () {... }
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/BufferedImage-in-Tapestry-tp5714465p5714522.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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

Reply via email to