mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-12 05:58:48 -05:00
Optimize Http requests on session creation
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@161 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
e49c103770
commit
48ca92fdf7
@ -260,14 +260,15 @@ public class ExchangeSession {
|
||||
// get webmail root url
|
||||
// providing credentials
|
||||
// manually follow redirect
|
||||
HttpMethod initmethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
||||
HttpMethod method = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
||||
|
||||
if (!isBasicAuthentication) {
|
||||
formLogin(httpClient, initmethod, userName, password);
|
||||
formLogin(httpClient, method, userName, password);
|
||||
// reexecute method with new base URL
|
||||
method = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
||||
}
|
||||
|
||||
// User may be authenticated, get various session information
|
||||
HttpMethod method = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
||||
int status = method.getStatusCode();
|
||||
if (status != HttpStatus.SC_OK) {
|
||||
HttpException ex = new HttpException();
|
||||
|
@ -50,6 +50,7 @@ public class ExchangeSessionFactory {
|
||||
|
||||
// get webmail root url (will not follow redirects)
|
||||
testMethod.setFollowRedirects(false);
|
||||
testMethod.setDoAuthentication(false);
|
||||
int status = httpClient.executeMethod(testMethod);
|
||||
testMethod.releaseConnection();
|
||||
ExchangeSession.LOGGER.debug("Test configuration status: " + status);
|
||||
|
@ -88,6 +88,7 @@ public class DavGatewayHttpClientFacade {
|
||||
int status = 0;
|
||||
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
|
||||
HttpMethod testMethod = new GetMethod(url);
|
||||
testMethod.setDoAuthentication(false);
|
||||
try {
|
||||
status = httpClient.executeMethod(testMethod);
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user