The remote service servlets used by RPC have code in them to prevent GET 
requests from doing anything.

As was said before, if your images are small (or you don't care about IE) you 
can return the image as a data URI (google is your friend here) and when you 
get the response simply do: new Image(myImageDataURI); 

Another option would be to save your image (either to the filesystem, or 
datastore) using some sort of identifier (hash maybe) 

Then use a separate HTTPServlet to return this image something like: 
/GetImage?ID=someid

But your original idea should have worked as well ... 
GWT.getModuleBaseURL()+imageName 

module base url is the location of the Module.js file used in the host page.

There is also GWT.getHostPageBaseURL() which is the location of the Host HTML 
page (which may be different than the module's location) 

-jason

On Oct 26, 2010, at 3:18 PM, Greg Dougherty wrote:

> 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-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
> 

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to