1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

Improve client host update fix

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1776 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-08-16 20:28:13 +00:00
parent 4fb681d009
commit d5f85ef7a1

View File

@ -555,6 +555,7 @@ public class DavExchangeSession extends ExchangeSession {
if (mailPath != null) {
// Exchange 2003
serverVersion = "Exchange2003";
fixClientHost(method);
checkPublicFolder(method);
try {
buildEmail(method.getURI().getHost());
@ -567,7 +568,7 @@ public class DavExchangeSession extends ExchangeSession {
// Gallookup is an Exchange 2003 only feature
disableGalLookup = true;
fixClientHost(method);
getEmailAndAliasFromOptions();
checkPublicFolder(method);
@ -732,14 +733,23 @@ public class DavExchangeSession extends ExchangeSession {
}
}
protected void fixClientHost(HttpMethod method) {
try {
// update client host
URI currentUri = method.getURI();
if (currentUri != null) {
httpClient.getHostConfiguration().setHost(currentUri.getHost(), currentUri.getPort(), currentUri.getScheme());
}
} catch (URIException e) {
LOGGER.warn("Unable to update http client host:" + e.getMessage(), e);
}
}
protected void checkPublicFolder(HttpMethod method) {
Cookie[] currentCookies = httpClient.getState().getCookies();
// check public folder access
try {
// update client host
httpClient.getHostConfiguration().setHost(method.getURI());
publicFolderUrl = httpClient.getHostConfiguration().getHostURL() + PUBLIC_ROOT;
DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
davPropertyNameSet.add(Field.getPropertyName("displayname"));
@ -1600,7 +1610,7 @@ public class DavExchangeSession extends ExchangeSession {
propertyValues.add(Field.createPropertyValue("duedate", convertTaskDateToZulu(vCalendar.getFirstVeventPropertyValue("DUE"))));
propertyValues.add(Field.createPropertyValue("datecompleted", convertTaskDateToZulu(vCalendar.getFirstVeventPropertyValue("COMPLETED"))));
propertyValues.add(Field.createPropertyValue("iscomplete", "2".equals(taskStatus)?"true":"false"));
propertyValues.add(Field.createPropertyValue("iscomplete", "2".equals(taskStatus) ? "true" : "false"));
propertyValues.add(Field.createPropertyValue("commonstart", convertTaskDateToZulu(vCalendar.getFirstVeventPropertyValue("DTSTART"))));
propertyValues.add(Field.createPropertyValue("commonend", convertTaskDateToZulu(vCalendar.getFirstVeventPropertyValue("DUE"))));