GData Java Client لا يعمل لأن Google يعيد التوجيه إلى الموقع المترجم

StackOverflow https://stackoverflow.com/questions/856590

سؤال

أنا أتابع الوثائق في واجهة برمجة تطبيقات بيانات Google Analytics - جافا وأنا أحصل على RedirectRequiredException استثناء ، لأن Google تعيد توجيهي إلى إصدار محلي من الموقع (www.google.si).

الرمز:

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) 

أيه أفكار؟

لقد قمت أيضًا بنشر هذا السؤال على مجموعة Google الخاصة بـ Analytics API، هنا.

هل كانت مفيدة؟

المحلول

عنوان URL غير صحيح.لقد قمت بنسخه من المثال، وهو غير صحيح.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top