我希望使用可断点续传机制上传 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();
最佳答案
您应该将请求发送到可续传上传网址,即 https://docs.google.com/feeds/upload/create-session/default/private/full
。
查看断点续传文档了解更多详情: https://developers.google.com/gdata/docs/resumable_upload
关于java - 使用 Java 的 Google List API PDF 上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11395200/