Я был так разочарован Google API. Каждый раз, когда я пытаюсь, это просто не работает даже после сбора тонн банок отсюда и там. Буду очень признателен, если кто-нибудь сможет мне помочь с приведенным ниже фрагментом кода ->
import java.net.URL;
import com.google.gdata.client.docs.DocsService;
import com.google.gdata.data.docs.DocumentListEntry;
import com.google.gdata.data.docs.DocumentListFeed;
public class TestGoogleDocs {
public static void main(String[] args) {
try {
System.err.println("== Testing Google Docs ==");
DocsService docService = new DocsService("Document list");
docService.setUserCredentials("*****@gmail.com", "******");
URL documentFeedURL = new URL("http://docs.google.com/feeds/documents/private/full");
DocumentListFeed docsFeed = docService.getFeed(documentFeedURL, DocumentListFeed.class);
for(DocumentListEntry entry: docsFeed.getEntries()){
System.err.println(entry.getTitle().getPlainText());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Я добавил следующие jar-файлы в classpath:
gdata-client-1.0.jar
gdata-client-meta-1.0.jar
gdata-core-1.0.jar
gdata-media-1.0.jar
gdata-docs-3.0.jar
gdata-docs-meta-3.0.jar
activation.jar
mail.jar
servlet-api.jar
guava-r09.jar
Ошибка, которую я получаю:
com.google.gdata.util.ResourceNotFoundException: Not Found
<HTML>
<HEAD>
<TITLE>Not Found</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Not Found</H1>
<H2>Error 404</H2>
</BODY>
</HTML>
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:591)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
at com.javainsight.cloud.TestGoogleDocs.main(TestGoogleDocs.java:21)