无法通过Java中的事件ID提取Google日历事件异常
我一直在使用Java的Gdata API(v2),并弄清楚了如何通过事件ID来获取事件.但是,我在获取重复出现的事件的异常时遇到了麻烦.
I've been working with the Gdata API for Java (v2), and have figured out how to fetch events by their id. However, I'm having trouble fetching exceptions to recurring events.
对于常规活动,我会这样获取它:
For a regular event, I would fetch it as such:
CalendarEventEntry event = getCalendarService().getEntry(new URL("https://www.google.com/calendar/feeds/"+googleCalId+"/private/full/"+eventId), CalendarEventEntry.class);
,正在查询的网址看起来像这样:
and the url being queried would look something like this:
https://www.google.com/calendar/feeds/772olgd23vedk7cmvmqgcke5jps%40group.calendar.google.com/private/full/6qlnf002ge3kh6fmp3i6skbuk
它可以毫无问题地获取!
And it fetches with no issue!
轻松自在.
但是,当我尝试使用相同的方法获取重复发生的事件的例外事件时,我遇到了问题.重复事件的网址为
However, when I try to fetch an event that is an exception to a recurring event using the same method, I run into problems. The url of the repeating event would be
https://www.google.com/calendar/feeds/772olgd23vedk7cmvmqgcke5jps%40group.calendar.google.com/private/full/6qlnf002ge3kh6fmp3i6skbuk_20120112
相同的网址,附加了_20120112.问题的性质:
Same url, with _20120112 appended. The nature of the problem:
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)
任何人都知道为什么会发生这种情况,或者有更好的方法来解决此问题?
Anybody have any ideas why this is happening or better ways to go about this?
经过大量的测试和开发,我得出的结论是,您可以重复事件的方式获取异常,就像获取正常事件的方式一样,但要注意:无法取消.
Well after much testing and development, I've concluded that you can fetch exceptions to repeating events in the same way one fetches normal events, with one caveat: they can't be canceled.
男人真是头疼:-P