Wednesday, September 8, 2010

Re: how to transmit an image over rpc?

Hi,

what I am trying to do is a photo album.

There is a directory structure on the server with an index.xml file in
each directory. On startup the index files are scanned and the
"content directory" is passed over rpc to the client. The client
displays nice menus and if the user selects an entry the images should
be shown.

If I pass URLs via rpc then the image directory must be world
readable.

Your advice with the servlet: Do you mean that the servlet should
return the image data itself and the setURL method of the Image class
knows that this is not a URL but the raw image data? Have I got you
right?

How would you realize what I want?

Thanks
Magnus

On 8 Sep., 08:12, Thad <thad.humphr...@gmail.com> wrote:
> You can't, at least not directly.  GWT does only what HTML does, and
> in HTML images are loaded via the SRC attribute in an IMG element.
> You can write basic doGet/doPost servlet that returns and image and
> put use its URL in com.google.gwt.user.client.ui.Image.setUrl() (which
> sets the SRC attribute).
>
> If you feel you must use an RPC call for the image, have the RPC call
> return a java.lang.String of the image (GIF, JPEG, or PNG) in Base
> 64.  In the onSuccess() method, use that result String as the argument
> for setUrl().
>
> On Sep 7, 9:25 am, Magnus <alpineblas...@googlemail.com> wrote:
>
> > Hi,
>
> > I tried to pass an Image object via RPC, but it doesn't work:
>
> > com.google.gwt.user.client.ui.Image is not assignable to
> > 'com.google.gwt.user.client.rpc.IsSerializable' or
> > 'java.io.Serializable' nor does it have a custom field serializer
> > (reached via com.google.gwt.user.client.ui.Image
>
> > How can I do that?
>
> > Magnus

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