1

我在谷歌应用引擎上有一个应用程序,在一段代码中我使用文档 API 阅读了谷歌文档。代码如下所示:

GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
            oauthParameters.setOAuthConsumerKey(Constants.CONSUMER_KEY);
            oauthParameters.setOAuthConsumerSecret(Constants.CONSUMER_SECRET);
            oauthParameters.setOAuthToken(Constants.ACCESS_TOKEN);
            oauthParameters.setOAuthTokenSecret(Constants.ACCESS_TOKEN_SECRET);
            DocsService client = new DocsService("sakshum-YourAppName-v1");
            client.setOAuthCredentials(oauthParameters,
                    new OAuthHmacSha1Signer());
            URL feedUrl = new URL("https://docs.google.com/feeds/default/private/full/");
            DocumentQuery dquery = new DocumentQuery(feedUrl);
            dquery.setTitleQuery(title);
            dquery.setTitleExact(true);
            dquery.setMaxResults(10);
            DocumentListFeed resultFeed = client.getFeed(dquery,
                    DocumentListFeed.class);

它失败了,但有例外:

vik.sakshum.sakshumweb.server.common.CommonServiceCode getGoogleDoc: Exception is :Unable to complete the HTTP request

这种情况并非总是发生,但有时会发生。那么,处理这种故障情况的正确方法应该是什么?GAE api非常不可靠是一个问题吗?这是一个代码问题,我可以修复它以更好的方式或其他方式处理它?

4

0 回答 0