Hello, i think u got it right. u can implement it in away as Thad has suggested. u can even implement it for simple <img src"" > as it is also hitting an URL so u can have a servlet and can give a src as "download?imgID=demoImage" and on the server side in the servlet which is serving a request for /download will send the content for that file.
this works as i have used same method in my projects. -- Aditya On Wed, Sep 8, 2010 at 4:42 PM, Magnus <[email protected]> wrote: > 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 <[email protected]> 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 <[email protected]> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > 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 [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.
