Monday, November 29, 2010

Re: Place image in object, send object over rpc, use hibernate to update database

Sending image data over RPC... how do you plan to use this binary data
on the client side?
It's not possible... JavaScript does not have any image-processing
API.

You can do something like this:

- Create the image binary data on the server, and label it with some
unique ID (store in memory, filesystem, db wherever).
- Create a servlet, say ServeImageServlet that will do something like
this

doGet(...) {
String id = request.getParameter("imageID");
InputStream input = huntForImageUsingID(id);
response.setContentType("image/png"); // or jpg, gif...

OutputStream output = response.getOutputStream();
//copy all data from input to output
}

- In your RPC response, just send the URL.
Assuming that the servlet is mapped to /img, the URL can be
something like /img?imageID=abcd

- In the GWT app, use this URL to create a new Image(url)

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.com


On Nov 29, 12:20 pm, Noor <baken...@gmail.com> wrote:
> Thus,the object will contain an image

--
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