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

Dav: new patch to reset session timeout with a GET method on /owa/

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1668 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-04-14 21:17:40 +00:00
parent 4121061c7a
commit 11676ee5fd

View File

@ -107,15 +107,18 @@ public class DavExchangeSession extends ExchangeSession {
@Override @Override
public boolean isExpired() throws NoRouteToHostException, UnknownHostException { public boolean isExpired() throws NoRouteToHostException, UnknownHostException {
// experimental: try to reset session timeout // experimental: try to reset session timeout
GetMethod getMethod = null; if ("Exchange2007".equals(serverVersion)) {
try { GetMethod getMethod = null;
getMethod = new GetMethod(URIUtil.encodePath(getFolderPath(""))); try {
httpClient.executeMethod(getMethod); getMethod = new GetMethod("/owa/");
} catch (IOException e) { getMethod.setFollowRedirects(false);
LOGGER.warn(e.getMessage()); httpClient.executeMethod(getMethod);
} finally { } catch (IOException e) {
if (getMethod != null) { LOGGER.warn(e.getMessage());
getMethod.releaseConnection(); } finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
} }
} }
@ -530,7 +533,7 @@ public class DavExchangeSession extends ExchangeSession {
if (mailPath == null || email == null) { if (mailPath == null || email == null) {
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED_PASSWORD_EXPIRED"); throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED_PASSWORD_EXPIRED");
} }
LOGGER.debug("Current user email is " + email + ", alias is " + alias + ", mailPath is " + mailPath + " on "+ serverVersion); LOGGER.debug("Current user email is " + email + ", alias is " + alias + ", mailPath is " + mailPath + " on " + serverVersion);
rootPath = mailPath.substring(0, mailPath.lastIndexOf('/', mailPath.length() - 2) + 1); rootPath = mailPath.substring(0, mailPath.lastIndexOf('/', mailPath.length() - 2) + 1);
} }
@ -2261,11 +2264,11 @@ public class DavExchangeSession extends ExchangeSession {
String contentType = mimeMessage.getContentType(); String contentType = mimeMessage.getContentType();
if (contentType.startsWith("text/plain")) { if (contentType.startsWith("text/plain")) {
propertyList.add(Field.createDavProperty("description", (String)mimeMessage.getContent())); propertyList.add(Field.createDavProperty("description", (String) mimeMessage.getContent()));
} else if (contentType.startsWith("text/html")) { } else if (contentType.startsWith("text/html")) {
propertyList.add(Field.createDavProperty("htmldescription", (String)mimeMessage.getContent())); propertyList.add(Field.createDavProperty("htmldescription", (String) mimeMessage.getContent()));
} else { } else {
LOGGER.warn("Unsupported content type: "+contentType+" message body will be empty"); LOGGER.warn("Unsupported content type: " + contentType + " message body will be empty");
} }
propertyList.add(Field.createDavProperty("subject", mimeMessage.getHeader("subject", ","))); propertyList.add(Field.createDavProperty("subject", mimeMessage.getHeader("subject", ",")));