GWT form upload using BlobstoreService App Engine

21 views
Skip to first unread message

Vishal Singh

unread,
Jun 14, 2010, 1:19:25 PM6/14/10
to Google Web Toolkit
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.

Jaroslav Záruba

unread,
Jun 14, 2010, 1:43:20 PM6/14/10
to google-we...@googlegroups.com
For different reasons I had to 'wrap' the blobstoreservice servlet with my own one. Maybe it could work for you as well.


--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Vishal Singh

unread,
Jun 14, 2010, 1:49:37 PM6/14/10
to Google Web Toolkit
Can you please elaborate on how to wrap the blobstoreservice servlet.
Are you suggesting writing a Filter ?

Thanks
Vishal

On Jun 14, 10:43 pm, Jaroslav Záruba <jaroslav.zar...@gmail.com>
wrote:
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .

Jaroslav Záruba

unread,
Jun 14, 2010, 2:03:44 PM6/14/10
to google-we...@googlegroups.com
I needed to get at least single character in response body when uploading a file. (Without that SwfUpload did not work due some Flash issue.)

-- 
MyWrappingServlet
{
  doPost(req, res)
  {
    // ...
    URL uploadUrl = new URL(blobstoreService.createUploadUrl("successPath"));
    copyRequestDataToUrl(req, url);
    res.getOutputStream().print("."); // the magic character
  }

  // this method applies the request data and headers to given URL
  copyRequestDataToUrl(req, url)
  {
    // ...
  }
}
--

To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.

Jaroslav Záruba

unread,
Jun 14, 2010, 2:12:36 PM6/14/10
to google-we...@googlegroups.com
oh, error in pseudo-code

    URL uploadUrl url = new URL(blobstoreService.createUploadUrl("successPath"));
    copyRequestDataToUrl(req, url);

sorry for that :)


2010/6/14 Jaroslav Záruba <jarosla...@gmail.com>

Vishal Singh

unread,
Jun 14, 2010, 11:56:14 PM6/14/10
to google-we...@googlegroups.com
Thanks. I will give a try to your solution.

2010/6/14 Jaroslav Záruba <jarosla...@gmail.com>
Reply all
Reply to author
Forward
0 new messages