From d2fc757ed24d748b80cf5a13e0ad920b24eb70f8 Mon Sep 17 00:00:00 2001 From: mguessan Date: Thu, 18 Mar 2010 09:21:23 +0000 Subject: [PATCH] Improve public folder url check git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@958 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSession.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 16baba08..a72c6c98 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -655,15 +655,26 @@ public class ExchangeSession { calendarUrl = getURIPropertyIfExists(properties, "calendar", URN_SCHEMAS_HTTPMAIL); contactsUrl = getURIPropertyIfExists(properties, "contacts", URN_SCHEMAS_HTTPMAIL); + // default public folder path + publicFolderUrl = "/public"; + + // check public folder access try { - PropFindMethod propFindMethod = new PropFindMethod("/public", CONTENT_TAG, 0); + if (inboxUrl != null) { + // try to build full public URI from inboxUrl + URI publicUri = new URI(inboxUrl, false); + publicUri.setPath("/public"); + publicFolderUrl = publicUri.getURI(); + } + PropFindMethod propFindMethod = new PropFindMethod(publicFolderUrl, CONTENT_TAG, 0); DavGatewayHttpClientFacade.executeMethod(httpClient, propFindMethod); + // update public folder URI publicFolderUrl = propFindMethod.getURI().getURI(); } catch (IOException e) { LOGGER.warn("Public folders not available: " + (e.getMessage() == null ? e : e.getMessage())); - // default public folder path publicFolderUrl = "/public"; } + LOGGER.debug("Inbox URL : " + inboxUrl + " Trash URL : " + deleteditemsUrl + " Sent URL : " + sentitemsUrl +