1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 03:32:22 -05:00

iCal fix : implement GET request on event

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@253 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2008-12-24 16:57:34 +00:00
parent 7b33fce14b
commit 43f4f632b5

View File

@ -330,6 +330,10 @@ public class CaldavConnection extends AbstractConnection {
int status = session.createOrUpdateEvent(path.substring("/calendar/".length()), body, etag);
sendHttpResponse(status, true);
} else if ("GET".equals(command) && path.startsWith("/calendar/")) {
ExchangeSession.Event event = session.getEvent(path.substring("/calendar/".length()));
sendHttpResponse(HttpStatus.SC_OK, null, "text/calendar;charset=UTF-8", event.getICS(), true);
} else if ("POST".equals(command) && path.startsWith("/outbox")) {
Map<String, String> valueMap = new HashMap<String, String>();
Map<String, String> keyMap = new HashMap<String, String>();
@ -398,6 +402,11 @@ public class CaldavConnection extends AbstractConnection {
int count = 0;
for (ExchangeSession.Event event : events) {
DavGatewayTray.debug("Retrieving event "+(++count)+"/"+size);
appendEventResponse(buffer, request, event);
}
}
protected void appendEventResponse(StringBuilder buffer, CaldavRequest request, ExchangeSession.Event event) throws IOException {
String eventPath = event.getPath().replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
buffer.append("<D:response>\n");
buffer.append(" <D:href>/calendar").append(eventPath).append("</D:href>\n");
@ -421,7 +430,6 @@ public class CaldavConnection extends AbstractConnection {
buffer.append(" </D:propstat>\n");
buffer.append(" </D:response>\n");
}
}
public void sendErr(int status, Exception e) throws IOException {
String message = e.getMessage();