On 26 oct, 16:18, Greg Dougherty <[email protected]> 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
