【问题标题】:Google List API PDF Upload with Java使用 Java 上传 Google List API PDF
【发布时间】:2012-07-09 12:39:46
【问题描述】:

我希望使用可恢复上传机制上传 PDF。但是,Web 服务器抛出 403 异常,指出:“文件必须使用可恢复上传机制上传。” 这尤其令人沮丧,因为我正在使用可恢复的上传机制。我能够将文件更改为 .txt 并且它可以有效地工作。

String contentType = DocumentListEntry.MediaType.fromFileName(file3.getName()).getMimeType();
System.out.println("This is break zero.");
MediaFileSource mediaFile = new MediaFileSource(file3, contentType);
System.out.println("This is break one.");
ResumableGDataFileUploader uploader =
      new ResumableGDataFileUploader.Builder(
          client, new URL("https://docs.google.com/feeds/default/private/full"), mediaFile, null /*empty meatadata*/)
          .title(mediaFile.getName())
          .chunkSize(DEFAULT_CHUNK_SIZE).executor(executor)
          .trackProgress(listener, PROGRESS_UPDATE_INTERVAL)
          .build();

【问题讨论】:

    标签: java pdf google-docs-api google-drive-api


    【解决方案1】:

    您应该将请求发送到可恢复的上传网址,即https://docs.google.com/feeds/upload/create-session/default/private/full

    查看可恢复上传文档了解更多详情:https://developers.google.com/gdata/docs/resumable_upload

    【讨论】:

      猜你喜欢
      • 2018-11-11
      • 2012-06-17
      • 1970-01-01
      • 2011-09-06
      • 1970-01-01
      • 1970-01-01
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多