Base64Utils from GWT's source does not use the standard MIME characters when 
encoding data to Base64. So I think thats why the browser does not display 
the image. To verify this, you can try and search a MIME standard Base64 
encoder, convert the byte array and put the base64 string into your data 
url.

Depending on what you want to do with the image you can try the following:
1.) Create a class BinaryData that holds the byte array and a mime type 
string (in your case "image/png")
2.) Write a plain servlet that reads data from your session based on a 
unique id and when its a BinaryData object returns the byte array with the 
correct mime type (and deletes the session entry to keep things clean).
3.) Use your existing servlet that fetches the byte array image, save it 
into a BinaryData instance and save that instance into your server session. 
Then return some unique id to your app and your app will use that id to 
fetch the data using the servlet from 2).

So basically your app asks your server to fetch an image from the web 
service. The server will do so and returns something like "193823903" as 
unique id. Now your app creates an Image widget and as URL it uses 
http://yourapp.com/service/binary?id=93823903. Your "binary" servlet will 
take the unique id, look it up in the session, found the BinaryData object 
with the byte array and returns the array with the specified mime type 
(image/png). The browser will display the image directly.
The only downside is that you can only access the image once (when you clean 
up your session when the image is requested) or you have to write a clean up 
thread so that your session doesn't get larger and larger.

Works great for me and I can use this for any kind of binary data like 
server side generated pdf's, sound files, images, etc.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/WUQA9KZ3S9kJ.
To post to this group, send email to google-web-toolkit@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