mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 03:32:22 -05:00
Caldav: use permanenturl for Caldav to avoid encoding issues
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@831 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
8d63d2d034
commit
1a78128a09
@ -79,6 +79,7 @@ public class ExchangeSession {
|
|||||||
protected static final DavPropertyNameSet EVENT_REQUEST_PROPERTIES = new DavPropertyNameSet();
|
protected static final DavPropertyNameSet EVENT_REQUEST_PROPERTIES = new DavPropertyNameSet();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
EVENT_REQUEST_PROPERTIES.add(DavPropertyName.create("permanenturl", SCHEMAS_EXCHANGE));
|
||||||
EVENT_REQUEST_PROPERTIES.add(DavPropertyName.GETETAG);
|
EVENT_REQUEST_PROPERTIES.add(DavPropertyName.GETETAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1594,6 +1595,7 @@ public class ExchangeSession {
|
|||||||
*/
|
*/
|
||||||
public class Event {
|
public class Event {
|
||||||
protected String href;
|
protected String href;
|
||||||
|
protected String permanentUrl;
|
||||||
protected String etag;
|
protected String etag;
|
||||||
|
|
||||||
protected MimePart getCalendarMimePart(MimeMultipart multiPart) throws IOException, MessagingException {
|
protected MimePart getCalendarMimePart(MimeMultipart multiPart) throws IOException, MessagingException {
|
||||||
@ -1623,8 +1625,8 @@ public class ExchangeSession {
|
|||||||
*/
|
*/
|
||||||
public String getICS() throws IOException {
|
public String getICS() throws IOException {
|
||||||
String result = null;
|
String result = null;
|
||||||
LOGGER.debug("Get event: " + href);
|
LOGGER.debug("Get event: " + permanentUrl);
|
||||||
GetMethod method = new GetMethod(URIUtil.encodePath(href));
|
GetMethod method = new GetMethod(permanentUrl);
|
||||||
method.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
method.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
||||||
method.setRequestHeader("Translate", "f");
|
method.setRequestHeader("Translate", "f");
|
||||||
try {
|
try {
|
||||||
@ -1651,9 +1653,9 @@ public class ExchangeSession {
|
|||||||
baos.close();
|
baos.close();
|
||||||
result = fixICS(new String(baos.toByteArray(), "UTF-8"), true);
|
result = fixICS(new String(baos.toByteArray(), "UTF-8"), true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.warn("Unable to get event at " + href + ": " + e.getMessage());
|
LOGGER.warn("Unable to get event at " + permanentUrl + ": " + e.getMessage());
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
LOGGER.warn("Unable to get event at " + href + ": " + e.getMessage());
|
LOGGER.warn("Unable to get event at " + permanentUrl + ": " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
method.releaseConnection();
|
method.releaseConnection();
|
||||||
}
|
}
|
||||||
@ -1694,7 +1696,7 @@ public class ExchangeSession {
|
|||||||
public List<Event> getEventMessages(String folderPath) throws IOException {
|
public List<Event> getEventMessages(String folderPath) throws IOException {
|
||||||
List<Event> result;
|
List<Event> result;
|
||||||
try {
|
try {
|
||||||
String searchQuery = "Select \"DAV:getetag\"" +
|
String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\"" +
|
||||||
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" +
|
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" +
|
||||||
" WHERE \"DAV:contentclass\" = 'urn:content-classes:calendarmessage'\n" +
|
" WHERE \"DAV:contentclass\" = 'urn:content-classes:calendarmessage'\n" +
|
||||||
" AND (NOT \"" + scheduleStateProperty.getNamespace().getURI() + scheduleStateProperty.getName() + "\" = 'CALDAV:schedule-processed')\n" +
|
" AND (NOT \"" + scheduleStateProperty.getNamespace().getURI() + scheduleStateProperty.getName() + "\" = 'CALDAV:schedule-processed')\n" +
|
||||||
@ -1728,7 +1730,7 @@ public class ExchangeSession {
|
|||||||
dateCondition = " AND \"urn:schemas:calendar:dtstart\" > '" + formatSearchDate(cal.getTime()) + "'\n";
|
dateCondition = " AND \"urn:schemas:calendar:dtstart\" > '" + formatSearchDate(cal.getTime()) + "'\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
String searchQuery = "Select \"DAV:getetag\"" +
|
String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\"" +
|
||||||
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" +
|
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" +
|
||||||
" WHERE (" +
|
" WHERE (" +
|
||||||
" \"urn:schemas:calendar:instancetype\" = 1\n" +
|
" \"urn:schemas:calendar:instancetype\" = 1\n" +
|
||||||
@ -1805,8 +1807,8 @@ public class ExchangeSession {
|
|||||||
|
|
||||||
protected Event buildEvent(MultiStatusResponse calendarResponse) throws URIException {
|
protected Event buildEvent(MultiStatusResponse calendarResponse) throws URIException {
|
||||||
Event event = new Event();
|
Event event = new Event();
|
||||||
String href = calendarResponse.getHref();
|
event.href = URIUtil.decode(calendarResponse.getHref());
|
||||||
event.href = URIUtil.decode(href);
|
event.permanentUrl = getPropertyIfExists(calendarResponse.getProperties(HttpStatus.SC_OK), "permanenturl", SCHEMAS_EXCHANGE);
|
||||||
event.etag = getPropertyIfExists(calendarResponse.getProperties(HttpStatus.SC_OK), "getetag", Namespace.getNamespace("DAV:"));
|
event.etag = getPropertyIfExists(calendarResponse.getProperties(HttpStatus.SC_OK), "getetag", Namespace.getNamespace("DAV:"));
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user