GData Java 客户端无法工作,因为 Google 重定向到本地化网站
代码:
AnalyticsService as = new AnalyticsService("me-myapp-1.0");
as.setUserCredentials(username, password);
AccountFeed accountFeed = as.getFeed(
new URL("https://www.google.com/analytics/accounts/default"),
AccountFeed.class);
最后一个方法调用抛出:
Exception in thread "main" com.google.gdata.util.RedirectRequiredException: Found
<HTML><HEAD><meta http-equiv="content-type" content="text/
html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.si/">here</A>.
</BODY></HTML>
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse (GoogleGDataRequest.java:541)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse (HttpGDataRequest.java:535)
at com.google.gdata.client.http.HttpGDataRequest.execute (HttpGDataRequest.java:514)
at com.google.gdata.client.http.GoogleGDataRequest.execute (GoogleGDataRequest.java:515)
at com.google.gdata.client.Service.getFeed(Service.java:1016)
at com.google.gdata.client.Service.getFeed(Service.java:879)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:638)
at com.google.gdata.client.Service.getFeed(Service.java:898)
at org.kubje.jaka.gapump.App.main(App.java:42)
有什么想法吗?
我还将这个问题发布到 Analytics API 的 Google 群组,此处。
I'm following the documentation at Google Analytics Data API - Java
and am getting the RedirectRequiredException
exception, because Google
is redirecting me to a local version of the site (www.google.si).
The code:
AnalyticsService as = new AnalyticsService("me-myapp-1.0");
as.setUserCredentials(username, password);
AccountFeed accountFeed = as.getFeed(
new URL("https://www.google.com/analytics/accounts/default"),
AccountFeed.class);
The last method call throws:
Exception in thread "main" com.google.gdata.util.RedirectRequiredException: Found
<HTML><HEAD><meta http-equiv="content-type" content="text/
html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.si/">here</A>.
</BODY></HTML>
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse (GoogleGDataRequest.java:541)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse (HttpGDataRequest.java:535)
at com.google.gdata.client.http.HttpGDataRequest.execute (HttpGDataRequest.java:514)
at com.google.gdata.client.http.GoogleGDataRequest.execute (GoogleGDataRequest.java:515)
at com.google.gdata.client.Service.getFeed(Service.java:1016)
at com.google.gdata.client.Service.getFeed(Service.java:879)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:638)
at com.google.gdata.client.Service.getFeed(Service.java:898)
at org.kubje.jaka.gapump.App.main(App.java:42)
Any ideas?
I've also posted this question to the Analytics API's Google Group, here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
网址不正确。 我从示例中复制了它,这是不正确的。
The URL was incorrect. I copied it from the example, which was incorrect.