Hardcode /owa/ path in getAliasFromOptions and getEmailFromOptions for Exchange 2007, improve failure message

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1008 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-04-20 15:01:22 +00:00
parent 50adca5572
commit e0cf54495d
3 changed files with 12 additions and 13 deletions

View File

@ -567,11 +567,11 @@ public class ExchangeSession {
URL baseURL = new URL(mailBoxBaseHref);
mailPath = baseURL.getPath();
LOGGER.debug("Base href found in body, mailPath is " + mailPath);
buildEmail(method.getURI().getHost(), method.getPath());
buildEmail(method.getURI().getHost());
LOGGER.debug("Current user email is " + email);
} else {
// failover for Exchange 2007 : build standard mailbox link with email
buildEmail(method.getURI().getHost(), method.getPath());
buildEmail(method.getURI().getHost());
mailPath = "/exchange/" + email + '/';
LOGGER.debug("Current user email is " + email + ", mailPath is " + mailPath);
}
@ -3013,9 +3013,8 @@ public class ExchangeSession {
* Determine user email through various means.
*
* @param hostName Exchange server host name for last failover
* @param methodPath current httpclient method path
*/
public void buildEmail(String hostName, String methodPath) {
public void buildEmail(String hostName) {
// first try to get email from login name
alias = getAliasFromLogin();
email = getEmail(alias);
@ -3031,17 +3030,17 @@ public class ExchangeSession {
}
if (email == null) {
// failover : get email from Exchange 2007 Options page
alias = getAliasFromOptions(methodPath);
alias = getAliasFromOptions();
email = getEmail(alias);
// failover: get email from options
if (alias != null && email == null) {
email = getEmailFromOptions(methodPath);
email = getEmailFromOptions();
}
}
if (email == null) {
LOGGER.debug("Unable to get user email with alias " + getAliasFromLogin()
+ " or " + getAliasFromMailPath()
+ " or " + getAliasFromOptions(methodPath)
+ " or " + getAliasFromOptions()
);
// last failover: build email from domain name and mailbox display name
StringBuilder buffer = new StringBuilder();
@ -3066,11 +3065,11 @@ public class ExchangeSession {
static final String MAILBOX_BASE = "/cn=";
protected String getAliasFromOptions(String path) {
protected String getAliasFromOptions() {
String result = null;
// get user mail URL from html body
BufferedReader optionsPageReader = null;
GetMethod optionsMethod = new GetMethod(path + "?ae=Options&t=About");
GetMethod optionsMethod = new GetMethod("/owa/?ae=Options&t=About");
try {
DavGatewayHttpClientFacade.executeGetMethod(httpClient, optionsMethod, false);
optionsPageReader = new BufferedReader(new InputStreamReader(optionsMethod.getResponseBodyAsStream()));
@ -3100,11 +3099,11 @@ public class ExchangeSession {
return result;
}
protected String getEmailFromOptions(String path) {
protected String getEmailFromOptions() {
String result = null;
// get user mail URL from html body
BufferedReader optionsPageReader = null;
GetMethod optionsMethod = new GetMethod(path + "?ae=Options&t=About");
GetMethod optionsMethod = new GetMethod("/owa/?ae=Options&t=About");
try {
DavGatewayHttpClientFacade.executeGetMethod(httpClient, optionsMethod, false);
optionsPageReader = new BufferedReader(new InputStreamReader(optionsMethod.getResponseBodyAsStream()));

View File

@ -29,7 +29,7 @@ EXCEPTION_INVALID_PARAMETER=Invalid parameter: {0}
EXCEPTION_NETWORK_DOWN=All network interfaces down or host unreachable !
EXCEPTION_UNABLE_TO_CREATE_MESSAGE=Unable to create message {0}: {1}{2}{3}
EXCEPTION_UNABLE_TO_GET_FOLDER=Unable to get folder at {0}
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Unable to get mail folder at {0}
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Unable to get mail folder at {0}, Webdav not available on Exchange server
EXCEPTION_UNABLE_TO_GET_PROPERTY=Unable to get property {0}
EXCEPTION_UNABLE_TO_MOVE_FOLDER=Unable to move folder, target already exists
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Unable to copy message, target already exists

View File

@ -26,7 +26,7 @@ EXCEPTION_INVALID_SEARCH_PARAMETERS=Parem
EXCEPTION_NETWORK_DOWN=Toutes les interfaces réseaux sont indisponibles ou serveur non joignable !
EXCEPTION_UNABLE_TO_CREATE_MESSAGE=Impossible de créer le message {0} : {1}{2}{3}
EXCEPTION_UNABLE_TO_GET_FOLDER=Impossible d''obtenir le dossier {0}
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Impossible d''obtenir le dossier de messagerie à l''adresse {0}
EXCEPTION_UNABLE_TO_GET_MAIL_FOLDER=Impossible d''obtenir le dossier de messagerie à l''adresse {0}, Webdav non disponible sur le serveur Exchange
EXCEPTION_UNABLE_TO_GET_PROPERTY=Impossible d''obtenir la propriété {0}
EXCEPTION_UNABLE_TO_MOVE_FOLDER=Impossible de déplacer le dossier, la cible existe
EXCEPTION_UNABLE_TO_COPY_MESSAGE=Impossible de copier le message, la cible existe