mirror of
https://github.com/moparisthebest/davmail
synced 2024-08-13 16:53:51 -04:00
Caldav: Experimental GET ics on folder and fix regression on public folder access
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@819 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
6b23e40b4e
commit
ad0ca0c875
@ -22,6 +22,7 @@ import davmail.AbstractConnection;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.Settings;
|
||||
import davmail.DavGateway;
|
||||
import davmail.util.StringUtil;
|
||||
import davmail.exception.DavMailAuthenticationException;
|
||||
import davmail.exception.DavMailException;
|
||||
import davmail.exchange.ExchangeSession;
|
||||
@ -268,8 +269,22 @@ public class CaldavConnection extends AbstractConnection {
|
||||
int status = session.deleteEvent(request.getExchangeFolderPath(), lastPath);
|
||||
sendHttpResponse(status);
|
||||
} else if (request.isGet()) {
|
||||
if (request.path.endsWith("/")) {
|
||||
// GET request on a folder => build ics content of all folder events
|
||||
String folderPath = request.getExchangeFolderPath();
|
||||
List<ExchangeSession.Event> events = session.getAllEvents(folderPath);
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("BEGIN:VCALENDAR");
|
||||
for (ExchangeSession.Event event : events) {
|
||||
String icsContent = StringUtil.getToken(event.getICS(), "BEGIN:VCALENDAR", "END:VCALENDAR");
|
||||
buffer.append(icsContent);
|
||||
}
|
||||
buffer.append("END:VCALENDAR");
|
||||
sendHttpResponse(HttpStatus.SC_OK, buildEtagHeader(session.getFolderCtag(folderPath)), "text/calendar;charset=UTF-8", buffer.toString(), true);
|
||||
} else {
|
||||
ExchangeSession.Event event = session.getEvent(request.getExchangeFolderPath(), lastPath);
|
||||
sendHttpResponse(HttpStatus.SC_OK, buildEtagHeader(event.getEtag()), "text/calendar;charset=UTF-8", event.getICS(), true);
|
||||
}
|
||||
} else if (request.isHead()) {
|
||||
// test event
|
||||
ExchangeSession.Event event = session.getEvent(request.getExchangeFolderPath(), lastPath);
|
||||
@ -1319,8 +1334,10 @@ public class CaldavConnection extends AbstractConnection {
|
||||
} else {
|
||||
StringBuilder calendarPath = new StringBuilder();
|
||||
for (int i = 0; i < endIndex; i++) {
|
||||
if (getPathElement(i).length() > 0) {
|
||||
calendarPath.append('/').append(getPathElement(i));
|
||||
}
|
||||
}
|
||||
return calendarPath.toString();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user