mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 19:22: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:
parent
7b33fce14b
commit
43f4f632b5
@ -330,6 +330,10 @@ public class CaldavConnection extends AbstractConnection {
|
|||||||
int status = session.createOrUpdateEvent(path.substring("/calendar/".length()), body, etag);
|
int status = session.createOrUpdateEvent(path.substring("/calendar/".length()), body, etag);
|
||||||
sendHttpResponse(status, true);
|
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")) {
|
} else if ("POST".equals(command) && path.startsWith("/outbox")) {
|
||||||
Map<String, String> valueMap = new HashMap<String, String>();
|
Map<String, String> valueMap = new HashMap<String, String>();
|
||||||
Map<String, String> keyMap = new HashMap<String, String>();
|
Map<String, String> keyMap = new HashMap<String, String>();
|
||||||
@ -398,6 +402,11 @@ public class CaldavConnection extends AbstractConnection {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
for (ExchangeSession.Event event : events) {
|
for (ExchangeSession.Event event : events) {
|
||||||
DavGatewayTray.debug("Retrieving event "+(++count)+"/"+size);
|
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("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
String eventPath = event.getPath().replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
||||||
buffer.append("<D:response>\n");
|
buffer.append("<D:response>\n");
|
||||||
buffer.append(" <D:href>/calendar").append(eventPath).append("</D:href>\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:propstat>\n");
|
||||||
buffer.append(" </D:response>\n");
|
buffer.append(" </D:response>\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void sendErr(int status, Exception e) throws IOException {
|
public void sendErr(int status, Exception e) throws IOException {
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
|
Loading…
Reference in New Issue
Block a user