mirror of
https://github.com/moparisthebest/davmail
synced 2024-08-13 16:53:51 -04: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
|
// get webmail root url
|
||||||
// providing credentials
|
// providing credentials
|
||||||
// manually follow redirect
|
// manually follow redirect
|
||||||
HttpMethod initmethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
HttpMethod method = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
||||||
|
|
||||||
if (!isBasicAuthentication) {
|
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
|
// User may be authenticated, get various session information
|
||||||
HttpMethod method = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, baseUrl);
|
|
||||||
int status = method.getStatusCode();
|
int status = method.getStatusCode();
|
||||||
if (status != HttpStatus.SC_OK) {
|
if (status != HttpStatus.SC_OK) {
|
||||||
HttpException ex = new HttpException();
|
HttpException ex = new HttpException();
|
||||||
|
@ -50,6 +50,7 @@ public class ExchangeSessionFactory {
|
|||||||
|
|
||||||
// get webmail root url (will not follow redirects)
|
// get webmail root url (will not follow redirects)
|
||||||
testMethod.setFollowRedirects(false);
|
testMethod.setFollowRedirects(false);
|
||||||
|
testMethod.setDoAuthentication(false);
|
||||||
int status = httpClient.executeMethod(testMethod);
|
int status = httpClient.executeMethod(testMethod);
|
||||||
testMethod.releaseConnection();
|
testMethod.releaseConnection();
|
||||||
ExchangeSession.LOGGER.debug("Test configuration status: " + status);
|
ExchangeSession.LOGGER.debug("Test configuration status: " + status);
|
||||||
|
@ -88,6 +88,7 @@ public class DavGatewayHttpClientFacade {
|
|||||||
int status = 0;
|
int status = 0;
|
||||||
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
|
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
|
||||||
HttpMethod testMethod = new GetMethod(url);
|
HttpMethod testMethod = new GetMethod(url);
|
||||||
|
testMethod.setDoAuthentication(false);
|
||||||
try {
|
try {
|
||||||
status = httpClient.executeMethod(testMethod);
|
status = httpClient.executeMethod(testMethod);
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user