It's not a little overcomplicated ? Just don't send the image into a normal HTTP request ?
Oscar On Feb 10, 9:22 pm, John Ivens <[email protected]> wrote: > The trick I have used is to encode the image in Base64, and then send the > image as a String in the return. > > public String getDither(int steps, double spiralDistance, double magnitude) > { > ... make the image ( a spiral dither pattern) and save to disk > return Base64.encodeFromFile("myFile.png"); > > } > On Wed, Feb 10, 2010 at 12:50 PM, Ralf B <[email protected]> wrote: > > Hello everybody, > > > I am new to GWT and want to have a service that transfers an Image > > object (com.google.gwt.user.client.ui.Image) back to the client. > > (Using GWT 2.0.0 with Eclipse Galileo and Eclipse GWT plugin). > > > On the client, I have the following service method: > > > import com.google.gwt.user.client.ui.Image; > > Image getImage(); > > > and the following service async method: > > > import com.google.gwt.user.client.ui.Image; > > void getImage(AsyncCallback<Image> callback); > > > On the server, I have the following service implementation: > > > import com.google.gwt.user.client.ui.Image; > > @Override > > public Image getEventTimeline() { > > > // 1) code to generate image from data > > > // 2) create new image and return to client > > Image image = new Image("test.png"); > > return image; > > } > > > When I compile the code, I get the following error: > > > ....[ERROR] 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) > > [ERROR] com.google.gwt.user.client.ui.Image has no > > available instantiable subtypes. (reached via > > com.google.gwt.user.client.ui.Image) > > [ERROR] subtype > > 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).... > > > This suggests that an Image cannot be serialized. I have two questions > > about this: > > > 1) Isn't every Google object serializable by default. Otherwise, what > > is the point of having a separate image class in GWT? > > > 2) What is the proper way of doing this? I want to create the image > > server-sided every time a user clicks a button and return it back to > > the user where it is supposed to be displayed in a panel. > > > Any suggestions? > > > Thanks a lot, > > > Ralf > > > -- > > 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.
