I have attached the code. I am getting error (internal server error).
In appengine-web.xml file I have declared the property tag for disable
cookie, i.e
<property name=*"com.google.gdata.DisablecookieHandler"* value=*"true"*/>
I am not able to find out the error. Please help me out.
--
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/calendar/community/forum.html
package com.accenture.project;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.calendar.CalendarEntry;
import com.google.gdata.data.calendar.CalendarEventEntry;
import com.google.gdata.data.calendar.CalendarFeed;
import com.google.gdata.data.extensions.When;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
@SuppressWarnings("serial")
public class CalendarServlet extends HttpServlet {
public static Logger logger = Logger.getLogger("CalendarServlet");
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
CalendarFeed resultFeed = null;
try {
CalendarService myService = new
CalendarService("testCalendarService");
myService.setUserCredentials("[email protected]",
"testlogin");
// Send the request and print the response
URL feedUrl = new
URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
resultFeed = myService.getFeed(feedUrl,
CalendarFeed.class);
System.out.println("Your calendars:");
System.out.println();
if(resultFeed!=null){
int resultFeedSize =
resultFeed.getEntries().size();
for (int i = 0; i <resultFeedSize; i++)
{
CalendarEntry entry =
resultFeed.getEntries().get(i);
System.out.println("\t" +
entry.getTitle().getPlainText());
}
}
URL postUrl =
new
URL("https://www.google.com/calendar/feeds/[email protected]/private/full");
CalendarEventEntry myEntry = new
CalendarEventEntry();
myEntry.setTitle(new PlainTextConstruct("Tennis
with Beth"));
myEntry.setContent(new PlainTextConstruct("Meet
for a quick lesson."));
DateTime startTime =
DateTime.parseDateTime("2011-09-01T15:00:00-08:00");
DateTime endTime =
DateTime.parseDateTime("2011-09-01T17:00:00-08:00");
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);
// Send the request and receive the response:
CalendarEventEntry insertedEntry =
myService.insert(postUrl, myEntry);
logger.log(Level.INFO,"after creating entry");
} catch (AuthenticationException authenticationexp) {
// TODO Auto-generated catch block
authenticationexp.printStackTrace();
} catch (ServiceException serviceExp) {
// TODO Auto-generated catch block
serviceExp.printStackTrace();
}
resp.setContentType("after complete processing");
}
}