Как отправить большой файл (> 5 МБ )из Blobstore на Google Диск?

У меня есть большие двоичные объекты, хранящиеся в моем Blobstore, и я хочу отправить эти файлы на Google Диск. Когда я использую UrlFetchService Google App Engine

URLFetchService fetcher = URLFetchServiceFactory.getURLFetchService();
URL url = new URL("https://www.googleapis.com/upload/drive/v1/files");
HTTPRequest httpRequest = new HTTPRequest(url, HTTPMethod.POST);
httpRequest.addHeader(new HTTPHeader("Content-Type", contentType));
httpRequest.addHeader(new HTTPHeader("Authorization", "OAuth " + accessToken));
httpRequest.setPayload(buffer.array());
Future future = fetcher.fetchAsync(httpRequest);
try {
  HTTPResponse response = (HTTPResponse) future.get();
} catch (Exception e) {
  log.warning(e.getMessage());
}

Задача:Когда файл превышает 5 МБ, он превышает предел размера запроса UrlFetchService (Ссылка:https://developers.google.com/appengine/docs/java/urlfetch/overview#Quotas_and_Limits)

Альтернатива:Используя API Google Диска, у меня есть этот код:

File body = new File();
body.setTitle(title);
body.setDescription(description);
body.setMimeType(mimeType);

// File's content.
java.io.File fileContent = new java.io.File(filename);
FileContent mediaContent = new FileContent(mimeType, fileContent);

File file = service.files().insert(body, mediaContent).execute();

Проблема с этим решением:FileOutputStream не поддерживается в Google App Engine для управления чтением byte[] из Blobstore.

Любые идеи?

7
задан Nick Johnson 27 June 2012 в 00:56
поделиться