我在尝试将文件上传到Dropbox帐户时收到了com.dropbox.core.NetworkIOException:
。浏览器是受限制的http代理。在将文件上传到核心API之前,我是否需要进行任何代理配置?
public class Main {
private static final String ACCESS_TOKEN = "MY ACCESSTOCKEN";
public static void main(String args[]) throws DbxException, IOException {
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
FullAccount account = client.users().getCurrentAccount();
ListFolderResult result = client.files().listFolder("");
while (true) {
for (Metadata metadata : result.getEntries()) { }
if (!result.getHasMore()) {
break;
}
result = client.files().listFolderContinue(result.getCursor());
}
try (InputStream in = new FileInputStream("test.txt")) {
FileMetadata metadata = client.files().uploadBuilder("/test.txt")
.uploadAndFinish(in);
}
}
}
答案 0 :(得分:0)
最可能的原因是您在代理服务器后面,您可以通过编程方式设置代理服务器。