1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

Improve public folder url check

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@958 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-03-18 09:21:23 +00:00
parent f7e839f02a
commit d2fc757ed2

View File

@ -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 +