1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-04 14:52:24 -05:00

New failover call in checkEndPointUrl

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2208 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-01-10 18:15:26 +00:00
parent 93b0f5ecf2
commit aa08c73a70

View File

@ -169,7 +169,17 @@ public class EwsExchangeSession extends ExchangeSession {
try {
int status = DavGatewayHttpClientFacade.executeNoRedirect(httpClient, checkMethod);
if (status == HttpStatus.SC_UNAUTHORIZED) {
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED");
// retry with /ews/exchange.asmx
checkMethod.releaseConnection();
checkMethod = new HeadMethod(endPointUrl);
checkMethod.setFollowRedirects(true);
status = DavGatewayHttpClientFacade.executeNoRedirect(httpClient, checkMethod);
if (status == HttpStatus.SC_UNAUTHORIZED) {
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED");
} else if (status != HttpStatus.SC_OK) {
throw new IOException("Ews endpoint not available at " + checkMethod.getURI().toString()+" status "+status);
}
} else if (status != HttpStatus.SC_OK) {
throw new IOException("Ews endpoint not available at " + checkMethod.getURI().toString()+" status "+status);
}