mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
EWS: Exchange 2010 compatibility: add test cookie, access /ews/exchange.asmx endpoint
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1296 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
2a9c62ec14
commit
8947927c01
@ -422,6 +422,9 @@ public abstract class ExchangeSession {
|
||||
((PostMethod) logonMethod).addParameter(passwordInput, password);
|
||||
((PostMethod) logonMethod).addParameter("trusted", "4");
|
||||
((PostMethod) logonMethod).addParameter("flags", "4");
|
||||
|
||||
// add exchange 2010 cookie
|
||||
logonMethod.addRequestHeader("Cookie", "PBack=0");
|
||||
logonMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, logonMethod);
|
||||
|
||||
// test form based authentication
|
||||
|
@ -29,7 +29,7 @@ import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.HeadMethod;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
@ -83,17 +83,17 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
protected void buildSessionInfo(HttpMethod method) throws DavMailException {
|
||||
// nothing to do, mailPath not used in EWS mode
|
||||
// check EWS access
|
||||
HttpMethod headMethod = new HeadMethod("/ews/services.wsdl");
|
||||
HttpMethod getMethod = new GetMethod("/ews/exchange.asmx");
|
||||
try {
|
||||
headMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, headMethod);
|
||||
if (headMethod.getStatusCode() != HttpStatus.SC_OK) {
|
||||
throw DavGatewayHttpClientFacade.buildHttpException(headMethod);
|
||||
getMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, getMethod);
|
||||
if (getMethod.getStatusCode() != HttpStatus.SC_OK) {
|
||||
throw DavGatewayHttpClientFacade.buildHttpException(getMethod);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
throw new DavMailAuthenticationException("EXCEPTION_EWS_NOT_AVAILABLE");
|
||||
} finally {
|
||||
headMethod.releaseConnection();
|
||||
getMethod.releaseConnection();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -169,7 +169,7 @@ public final class StringUtil {
|
||||
*/
|
||||
public static String urlDecodeAmpersand(String name) {
|
||||
String result = name;
|
||||
if (name.indexOf("%26") >= 0) {
|
||||
if (name != null && name.indexOf("%26") >= 0) {
|
||||
result = URLENCODED_AMP_PATTERN.matcher(result).replaceAll("&");
|
||||
}
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user