Blob Upload Hanging

33 views
Skip to first unread message

Killian

unread,
Sep 27, 2012, 10:49:37 AM9/27/12
to google-a...@googlegroups.com
Hi Everyone,

I was wondering if anything had changed recently in relation to uploading blobs to appengine from external applications? What used to work perfectly only 3 months ago is now hanging when doing a http post to upload the blob.

The code (see below) which was working fine previously consists in fetching a pull queue from AppEngine (using the REST API), doing some stuff with this task received and then uploading back the result as a Blob on AppEngine. The url to upload the blob to is created by appengine using  blobstoreService.createUploadUrl("/upload"); 


I had a look at the logs on AppEngine and it seems like the servlet in charge of /upload isn't being triggered. 

I'm honestly out of ideas at this stage, any help would be greatly appreciated ! :-)

Cheers,

Killian

//Code

public boolean uploadAsBlob(String dataToWrite, String uploadURL) {

     try {

          BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(tempFileLocation));

          bufferedWriter.write(dataToWrite);

          bufferedWriter.newLine();

          bufferedWriter.close();

          MultipartEntity entity = new MultipartEntity();

          entity.addPart(blobFileName, new FileBody(new File(tempFileLocation)));

          HttpPost method = new HttpPost(uploadURL);

          method.setEntity(entity);

          final HttpParams httpParams = new BasicHttpParams();

          HttpConnectionParams.setConnectionTimeout(httpParams, 10000);

          DefaultHttpClient httpclient = new DefaultHttpClient(httpParams);

//It hangs at the following line!

          HttpResponse response = httpclient.execute(method);

          if (response.getStatusLine().getStatusCode() == 200) {

               logger.info("Uploaded blob to url: " + uploadURL);

               return true;

          } else {

               logger.warning("Couldn't upload blob to url: " + uploadURL);

          }


} catch (Exception e) {

logger.warning("Exception " + e.getMessage() + " occured while uploading blob to url:" + uploadURL);

logger.warning("Couldn't upload blob to url: " + uploadURL);

}

return false;

}

Reply all
Reply to author
Forward
0 new messages