views:

71

answers:

2

I am using GWT and Google App Engine Java for my application. I have a profile screen where user enters profile information like name, age and address, saves it and gets success or failure message. I developed this initial application using GWT-RPC and it worked fine. I had a new requirement where I have to store image of the user. I am using BlobstoreService to store images. This has created complications in the flow. I had to use FormPanel as it is the only way to do a FileUpload in GWT. The BlobStore service servlet expects a redirect on completion. As a result it cannot now return any status back to my GWT application once the profile is saved. Is there easy to store images using GWT along with other form fields and show a status message back to user once the profile is saved.

A: 

I had the same problem. As a workaround I'm using a redirection to a servlet that print a status message for the client to parse. I'm passing the websafe string representation of the key to that result servlet.

That's a bit hackey, I'd like someone to come with a better answer, or explain why the blobstore servlet have to redirect.

Florian d'Erfurth
A: 

Yeah, things get more complicated with uploads in GWT.

You can save the form data and image in separate RPCs, and either include a status message in the response to the image upload, or fire off a 3rd RPC when the form returns to get any status or metadata you need.

spankalee