Tuesday, October 26, 2010

Re: How do I send program generated Images to my users?

Thank you Thomas.

Given what I'm trying to do, I need to have the Image created via a
GWT RPC call. However, nothing keeps me from implementing doGet ()
within my servlet, so I did that, and now I can serve up the images
cleanly, and I can even cache them! :-)

Greg

On Oct 26, 11:26 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On 26 oct, 16:18, Greg Dougherty <dougherty.greg...@mayo.edu> wrote:
>
>
>
> > > - Generate the image with a servlet on the fly (return the appropriate mime
> > > type and the image) or (if the images are small)
>
> > Great idea.  HOW DO I DO THAT?
>
> > Sorry for the shouting, but I'm already generating the things on the
> > fly.  If I knew how to return them other than as a file, I'd already
> > be doing that.
>
> > I've got a GWT client and a GWT Servlet.  The GWT Servlet has an image
> > sitting in its memory.  I want to get that image to the client.  If
> > you can give me sample code, point me to sample code, or point me to a
> > well documented Java function, that would be great, and you would have
> > my full appreciation.
>
> > Telling me to "do X' is pointless, if you don't give me some way of
> > figuring out how to DO that X.  Because if I knew how to do it, I
> > would have already done it, and not wasted everyone's time with these
> > questions.
>
> The thing is: instead of calling your servlet through GWT-RPC or
> whatever (anything implemented above XMLHttpRequest) to generate the
> image; "generate" the call through a new Image(), passing the
> "arguments" in the URL.
> Your servlet will then be a bare HttpServlet (no GWT involved, just
> implement de doGet method) and you'd send the image back using the
> HttpServletResponse's OutputStream (after setting the
> HttpServletResponse's content-type to the appropriate value, for
> instance "image/png").
> To get the arguments on the server-side, if you passed them in the
> query string, then HttpServletRequest#getParameter will work
> seamlessly.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment