我一直在使用 Gdata API for Java (v2),并且已经弄清楚如何通过它们的 id 获取事件。但是,我无法获取重复事件的异常。
对于常规活动,我会这样获取它:
CalendarEventEntry event = getCalendarService().getEntry(new URL("https://www.google.com/calendar/feeds/"+googleCalId+"/private/full/"+eventId), CalendarEventEntry.class);
并且被查询的 url 看起来像这样:
https://www.google.com/calendar/feeds/772olgd23vedk7cmvmqgcke5jps%40group.calendar.google.com/private/full/6qlnf002ge3kh6fmp3i6skbuk
它可以毫无问题地获取!
十分简单。
但是,当我尝试使用相同的方法获取重复事件的异常事件时,我遇到了问题。重复事件的 url 将是
https://www.google.com/calendar/feeds/772olgd23vedk7cmvmqgcke5jps%40group.calendar.google.com/private/full/6qlnf002ge3kh6fmp3i6skbuk_20120112
相同的网址,附加了 _20120112。问题的性质:
com.google.gdata.util.ResourceNotFoundException: Not Found
<html><head><meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>Error</title>
<style type="text/css">body {font-family: arial,sans-serif}</style></head>
<body text="#000000" bgcolor="#ffffff"><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td rowspan="3" width="1%" nowrap><b><font face="times" size="10"><font color="#0039b6">G</font> <font color="#c41200">o</font> <font color="#f3c518">o</font> <font color="#0039b6">g</font> <font color="#30a72f">l</font> <font color="#c41200">e</font></font> </b></td>
<td> </td></tr>
<tr><td bgcolor="#3366cc"><font face="arial,sans-serif" color="#ffffff"><b>Error</b></font></td></tr>
<tr><td> </td></tr></table>
<blockquote>Cannot access the calendar you requested</blockquote>
<p></p>
<div style="background:#3366cc; width:1px; height:4px"></div></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.getEntry(Service.java:1352)
at com.google.gdata.client.GoogleService.getEntry(GoogleService.java:567)
at com.google.gdata.client.Service.getEntry(Service.java:1278)
at com.testsoftware.google.CalendarServiceManager.getEventById(CalendarServiceManager.java:410)
...stack of my program here...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
任何人有任何想法为什么会发生这种情况或更好的方法来解决这个问题?