-1
java 및 gdata API를 사용하여 캘린더 데이터를 관리합니다. 하지만 인터넷에 직접 액세스 할 수있는 경우에만 작동합니다. 제 경우에는 프록시를 사용해야합니다. 프록시를 통해 내 Google 캘린더의 데이터를 관리 할 수있는 방법이 있습니까?프록시가있는 Google Data API 클라이언트 라이브러리
System.setProperty("http.proxyHost", "myproxy.mydomain.com");
System.setProperty("http.proxyPort", "3128");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/....");
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
String encoded = new String(Base64.encodeBase64(new String("proxy_user:proxy_password").getBytes()));
String base64encodedCredentials = "Basic " + encoded;
myService.getRequestFactory().setPrivateHeader("Proxy-Authorization", base64encodedCredentials);
//!!! Exception in this line
myService.setUserCredentials("[email protected]", "my_google_password");
예외 : 프록시 모든없이
Exception in thread "main" com.google.gdata.util.AuthenticationException: Error connecting with login URI
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:549)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:319)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303)
at calendartest.CalendarTest.getCalendarEventsWithProxy(CalendarTest.java:145)
at calendartest.CalendarTest.main(CalendarTest.java:195)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
작동
I'v이 방법을 시도했다. (이
http://code.google.com/p/gdatacopier/wiki/ProxySupport : 파이썬
https://developers.google.com/gdata/articles/proxy_setup
지침에서 확인할 수 있습니다
하지만이 목적을 위해 자바를 사용합니다. 이 기사 (https://developers.google.com/gdata/articles/proxy_setup)를 보았는데 작동하지 않습니다. 이 기사는 이전 버전의 GData API에 대한 것입니다. –
어떤 버전을 사용하고 있습니까? –
농담 해? Oracle JDK 1.7.0_07. 분명히하기 위해 –