我想从我的桌面 Java 应用程序上传和下载文件到任何云。我在网上搜索并找到了关于 Temboo 的信息。我尝试使用它并编写一些代码来在我的 DropBox 帐户中创建一个示例文件夹。
我在我的 DropBox 中创建了一个应用程序并获得了应用程序密钥和应用程序密钥。然后我使用https://live.temboo.com/library/Library/Dropbox/FileOperations/CreateFolder/ OAUTH 向导并获得了我的访问令牌和访问令牌秘密。现在,我尝试运行下面的代码来创建一个名为“Test”的文件夹
CreateFolder createFolder = new com.temboo.Library.Dropbox.FileOperations.CreateFolder(session);
CreateFolder.CreateFolderInputSet createFolderInput = createFolder.newInputSet();
createFolderInput.set_NewFolderName(DROPBOX_BACKUP_FOLDERNAME);
createFolderInput.set_AppKey(DROPBOX_APP_KEY);
createFolderInput.set_AppSecret(DROPBOX_APP_SECRET);
createFolderInput.set_AccessToken(DROPBOX_ACCESS_TOKEN);
createFolderInput.set_AccessTokenSecret(DROPBOX_ACCESS_TOKEN_SECRET);
createFolder.execute(createFolderInput);
当我运行上面的代码时,它会抛出异常:
createFolder.execute(createFolderInput);
请查看异常情况:
com.temboo.core.TembooException: peer not authenticated
at com.temboo.core.TembooSession.postContent(TembooSession.java:168)
at com.temboo.core.Choreography.executeWithResults(Choreography.java:88)
at com.temboo.Library.Dropbox.FileOperations.CreateFolder.execute(CreateFolder.java:50)
at TestPackage.DropBoxCloudServer.createFolder(DropBoxCloudServer.java:55)
at TestPackage.DropBoxCloudServer.main(DropBoxCloudServer.java:20)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at com.sun.net.ssl.internal.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:352)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:339)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
at com.temboo.core.TembooSession.postContent(TembooSession.java:151)
... 4 more