From c6fb2f9e04a2cae456ea266e8e473a693dbf09de Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 5 Mar 2015 13:29:45 +0100
Subject: [PATCH 01/37] Remove any cookies/state after resetting authentication
of ExchangeServiceBase.
This prevents an old authentication from being reused by proxy firewalls like TMG.
---
.../webservices/data/ExchangeServiceBase.java | 22 ++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index 5abc10117..f4b35e17d 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -23,12 +23,14 @@
package microsoft.exchange.webservices.data;
+import org.apache.http.client.CookieStore;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
@@ -131,7 +133,7 @@ public abstract class ExchangeServiceBase implements Closeable {
protected CloseableHttpClient httpClient;
- protected HttpClientContext httpContext = HttpClientContext.create();
+ protected HttpClientContext httpContext;
protected HttpClientWebRequest request = null;
@@ -151,6 +153,7 @@ public abstract class ExchangeServiceBase implements Closeable {
protected ExchangeServiceBase() {
setUseDefaultCredentials(true);
initializeHttpClient();
+ initializeHttpContext();
}
protected ExchangeServiceBase(ExchangeVersion requestedServerVersion) {
@@ -195,7 +198,14 @@ private void initializeHttpClient() {
httpClient = httpClientBuilder.build();
}
- @Override
+ private void initializeHttpContext() {
+ // Use an own cookie store, instead of the httpClient's global store, so cookies get reset on reinitialization
+ CookieStore cookieStore = new BasicCookieStore();
+ httpContext = HttpClientContext.create();
+ httpContext.setCookieStore(cookieStore);
+ }
+
+ @Override
public void close() {
try {
httpClient.close();
@@ -579,6 +589,9 @@ public ExchangeCredentials getCredentials() {
public void setCredentials(ExchangeCredentials credentials) {
this.credentials = credentials;
this.useDefaultCredentials = false;
+
+ // Reset the httpContext, to remove any existing authentication cookies from subsequent requests
+ initializeHttpContext();
}
/**
@@ -605,8 +618,11 @@ public void setUseDefaultCredentials(boolean value) {
if (value) {
this.credentials = null;
}
- }
+ // Reset the httpContext, to remove any existing authentication cookies from subsequent requests
+ initializeHttpContext();
+ }
+
/**
* Gets the timeout used when sending HTTP requests and when receiving HTTP
* responses, in milliseconds.
From dfe00eecbbe1557a1b9ac34e6ec0f66a56a53e3f Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 5 Mar 2015 13:40:55 +0100
Subject: [PATCH 02/37] Update pom.xml for Eveoh settings.
---
.idea/codeStyleSettings.xml | 16 ++++++++++++++
.idea/misc.xml | 1 +
pom.xml | 44 ++++++++-----------------------------
3 files changed, 26 insertions(+), 35 deletions(-)
diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index ddacdf3e8..1b2ecbcf1 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -52,6 +52,14 @@
+
+
+
+
+
+
+
+
@@ -101,6 +109,14 @@
+
+
+
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index d1297649f..d13de0674 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,7 @@
+
- *
- * Example of using custom protocol socket factory per default instead of the standard one:
- *
- * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
- * Protocol.registerProtocol("https", easyhttps);
- *
- * HttpClient client = new HttpClient();
- * GetMethod httpget = new GetMethod("https://localhost/");
- * client.executeMethod(httpget);
- *
- *
- *
- *
- * DISCLAIMER: HttpClient developers DO NOT actively support this component.
- * The component is provided as a reference material, which may be inappropriate
- * for use without additional customization.
- *
- */
-
-class EwsSSLProtocolSocketFactory extends SSLConnectionSocketFactory {
-
- /**
- * The SSL Context.
- */
- private SSLContext sslcontext = null;
-
- /**
- * Constructor for EasySSLProtocolSocketFactory.
- *
- * @throws SSLException
- */
- public EwsSSLProtocolSocketFactory(SSLContext context) {
- super(context, SSLConnectionSocketFactory.STRICT_HOSTNAME_VERIFIER);
- this.sslcontext = context;
- }
-
-
-
- public SSLContext getContext() {
- return this.sslcontext;
- }
-
-
-
- public static EwsSSLProtocolSocketFactory build(TrustManager trustManager)
- throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
- SSLContext sslContext = SSLContexts.createDefault();
- sslContext.init(
- null,
- new TrustManager[] {new EwsX509TrustManager(null, trustManager)},
- null
- );
- return new EwsSSLProtocolSocketFactory(sslContext);
- }
-
- public boolean equals(Object obj) {
- return ((obj != null) && obj.getClass().equals(EwsSSLProtocolSocketFactory.class));
- }
-
- public int hashCode() {
- return EwsSSLProtocolSocketFactory.class.hashCode();
- }
-}
diff --git a/src/main/java/microsoft/exchange/webservices/data/EwsX509TrustManager.java b/src/main/java/microsoft/exchange/webservices/data/EwsX509TrustManager.java
deleted file mode 100644
index a0230451a..000000000
--- a/src/main/java/microsoft/exchange/webservices/data/EwsX509TrustManager.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-/**
- * EwsX509TrustManager is used for SSL handshake.
- *
- */
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
-class EwsX509TrustManager implements X509TrustManager {
- /**
- * The Standard TrustManager.
- */
- private X509TrustManager standardTrustManager = null;
-
- /**
- * Constructor for EasyX509TrustManager.
- */
- public EwsX509TrustManager(KeyStore keystore, TrustManager trustManager)
- throws NoSuchAlgorithmException, KeyStoreException {
- super();
- if (trustManager == null) {
- TrustManagerFactory factory =
- TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- factory.init(keystore);
- TrustManager[] trustmanagers = factory.getTrustManagers();
- if (trustmanagers.length == 0) {
- throw new NoSuchAlgorithmException("no trust manager found");
- }
- this.standardTrustManager = (X509TrustManager) trustmanagers[0];
- } else {
- standardTrustManager = (X509TrustManager) trustManager;
- }
- }
-
- /**
- * @see javax.net.ssl.X509TrustManager#checkClientTrusted(java.security.cert.X509Certificate[], String authType)
- */
- public void checkClientTrusted(X509Certificate[] certificates, String authType)
- throws CertificateException {
- standardTrustManager.checkClientTrusted(certificates, authType);
- }
-
- /**
- * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[], String authType)
- */
- public void checkServerTrusted(X509Certificate[] certificates, String authType)
- throws CertificateException {
-
- if ((certificates != null) && (certificates.length == 1)) {
- certificates[0].checkValidity();
- } else {
- standardTrustManager.checkServerTrusted(certificates, authType);
- }
- }
-
- /**
- * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()
- */
- public X509Certificate[] getAcceptedIssuers() {
- return this.standardTrustManager.getAcceptedIssuers();
- }
-}
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index f4b35e17d..da558e6f5 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -30,12 +30,15 @@
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayOutputStream;
@@ -137,6 +140,8 @@ public abstract class ExchangeServiceBase implements Closeable {
protected HttpClientWebRequest request = null;
+ private SSLConnectionSocketFactory sslConnectionSocketFactory;
+
// protected static HttpStatusCode AccountIsLocked = (HttpStatusCode)456;
/**
@@ -152,7 +157,6 @@ public abstract class ExchangeServiceBase implements Closeable {
*/
protected ExchangeServiceBase() {
setUseDefaultCredentials(true);
- initializeHttpClient();
initializeHttpContext();
}
@@ -173,29 +177,30 @@ protected ExchangeServiceBase(ExchangeServiceBase service, ExchangeVersion reque
this.userAgent = service.getUserAgent();
this.acceptGzipEncoding = service.getAcceptGzipEncoding();
this.httpHeaders = service.getHttpHeaders();
- }
-
- private void initializeHttpClient() {
- EwsSSLProtocolSocketFactory factory;
- try {
- factory = EwsSSLProtocolSocketFactory.build(null);
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Could not initialize HttpClientConnectionManager.", e);
- } catch (KeyStoreException e) {
- throw new RuntimeException("Could not initialize HttpClientConnectionManager.", e);
- } catch (KeyManagementException e) {
- throw new RuntimeException("Could not initialize HttpClientConnectionManager.", e);
+ this.sslConnectionSocketFactory = service.getSslConnectionSocketFactory();
+ }
+
+ private CloseableHttpClient getHttpClient() {
+ if (httpClient == null) {
+ Registry
+ registry =
+ RegistryBuilder.create()
+ .register("http", new PlainConnectionSocketFactory()).register("https",
+ sslConnectionSocketFactory
+ != null
+ ? sslConnectionSocketFactory
+ : SSLConnectionSocketFactory
+ .getSocketFactory()).build();
+
+ HttpClientConnectionManager httpConnectionManager = new BasicHttpClientConnectionManager(registry);
+ HttpClientBuilder
+ httpClientBuilder =
+ HttpClients.custom().setConnectionManager(httpConnectionManager)
+ .setTargetAuthenticationStrategy(new CookieProcessingTargetAuthenticationStrategy());
+ httpClient = httpClientBuilder.build();
}
- Registry registry = RegistryBuilder.create()
- .register("http", new PlainConnectionSocketFactory())
- .register("https", factory)
- .build();
-
- HttpClientConnectionManager httpConnectionManager = new BasicHttpClientConnectionManager(registry);
- HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(httpConnectionManager)
- .setTargetAuthenticationStrategy(new CookieProcessingTargetAuthenticationStrategy());
- httpClient = httpClientBuilder.build();
+ return httpClient;
}
private void initializeHttpContext() {
@@ -255,7 +260,7 @@ protected HttpWebRequest prepareHttpWebRequestForUrl(URI url, boolean acceptGzip
throw new ServiceLocalException(strErr);
}
- request = new HttpClientWebRequest(httpClient, httpContext);
+ request = new HttpClientWebRequest(getHttpClient(), httpContext);
try {
request.setUrl(url.toURL());
} catch (MalformedURLException e) {
@@ -847,4 +852,12 @@ protected static byte[] getSessionKey() {
return ExchangeServiceBase.binarySecret;
}
}
+
+ public SSLConnectionSocketFactory getSslConnectionSocketFactory() {
+ return sslConnectionSocketFactory;
+ }
+
+ public void setSslConnectionSocketFactory(SSLConnectionSocketFactory sslConnectionSocketFactory) {
+ this.sslConnectionSocketFactory = sslConnectionSocketFactory;
+ }
}
From 4280d72cd32a4cdb98257a1d5231bc235055ea2f Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Wed, 16 Sep 2015 14:24:10 +0200
Subject: [PATCH 05/37] Up version to 2.0-eveoh10.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index a262015dc..6203db4e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh9
+ 2.0-eveoh10Exchange Web Services Java APIExchange Web Services (EWS) Java API
From 62aebaa24001b73de00e44d1d0aad4e010696af3 Mon Sep 17 00:00:00 2001
From: Erik van Paassen
Date: Wed, 30 Sep 2015 16:36:15 +0200
Subject: [PATCH 06/37] Restore acceptGzipEncoding option.
---
.../exchange/webservices/data/ExchangeServiceBase.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index da558e6f5..0973ae09d 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -197,6 +197,11 @@ private CloseableHttpClient getHttpClient() {
httpClientBuilder =
HttpClients.custom().setConnectionManager(httpConnectionManager)
.setTargetAuthenticationStrategy(new CookieProcessingTargetAuthenticationStrategy());
+
+ if (!acceptGzipEncoding) {
+ httpClientBuilder.disableContentCompression();
+ }
+
httpClient = httpClientBuilder.build();
}
From 1a637d892bb17247573b290a083163791334b8e3 Mon Sep 17 00:00:00 2001
From: Erik van Paassen
Date: Wed, 30 Sep 2015 16:38:14 +0200
Subject: [PATCH 07/37] Update version number to 2.0-eveoh-11.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 6203db4e6..e626b02aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh10
+ 2.0-eveoh11Exchange Web Services Java APIExchange Web Services (EWS) Java API
From b3db6c521e5436ed6bf9e006144ddc667f791de1 Mon Sep 17 00:00:00 2001
From: Kenton Gray
Date: Wed, 25 Mar 2015 12:50:34 -0500
Subject: [PATCH 08/37] Adding a java/olson TimeZone conversion class
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is useful for setting appointments with timezones when you have
the java timezone. Otherwise there is no way to get the proper timezone
as they won’t have periods (even the getServerTimezones doesn’t have
the information needed). I’ve been using this for months (before all
this was on github) with great results
---
.../complex/time/OlsonTimeZoneDefinition.java | 56 ++
.../webservices/data/util/TimeZoneUtils.java | 614 ++++++++++++++++++
.../property/complex/OlsonTimeZoneTest.java | 50 ++
3 files changed, 720 insertions(+)
create mode 100644 src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java
create mode 100644 src/main/java/microsoft/exchange/webservices/data/util/TimeZoneUtils.java
create mode 100644 src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java
diff --git a/src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java b/src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java
new file mode 100644
index 000000000..08316475f
--- /dev/null
+++ b/src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java
@@ -0,0 +1,56 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.data.property.complex.time;
+
+
+import microsoft.exchange.webservices.data.exception.ServiceLocalException;
+import microsoft.exchange.webservices.data.util.TimeZoneUtils;
+
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * A TimeZoneDefinition class that allows mapping from a Java/Olson TimeZone to a MS TimeZone.
+ */
+public class OlsonTimeZoneDefinition extends TimeZoneDefinition {
+
+ /**
+ * Create a TimeZoneDefinition compatible with java.util.TimeZone
+ * @param timeZone a java time zone object, will be converted to Microsoft timezone.
+ */
+ public OlsonTimeZoneDefinition(TimeZone timeZone) {
+ final String microsoftTimeZoneName = TimeZoneUtils.getMicrosoftTimeZoneName(timeZone);
+ if (microsoftTimeZoneName != null) {
+ this.id = microsoftTimeZoneName;
+ }
+ this.name = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), TimeZone.LONG);
+ }
+
+ @Override
+ public void validate() throws ServiceLocalException {
+ if (this.id == null) {
+ throw new ServiceLocalException("Invalid TimeZone (" + this.name + ") Specified");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/microsoft/exchange/webservices/data/util/TimeZoneUtils.java b/src/main/java/microsoft/exchange/webservices/data/util/TimeZoneUtils.java
new file mode 100644
index 000000000..fd4396c3f
--- /dev/null
+++ b/src/main/java/microsoft/exchange/webservices/data/util/TimeZoneUtils.java
@@ -0,0 +1,614 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.data.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+/**
+ * Miscellany timezone functions
+ */
+public class TimeZoneUtils {
+ //a map of olson name > Microsoft Name
+ final static private Map olsonTimeZoneToMs = new HashMap();
+
+ static {
+ olsonTimeZoneToMs.put("Africa/Abidjan", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Accra", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Addis_Ababa", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Algiers", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Asmara", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Asmera", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Bamako", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Bangui", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Banjul", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Bissau", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Blantyre", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Brazzaville", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Bujumbura", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Cairo", "Egypt Standard Time");
+ olsonTimeZoneToMs.put("Africa/Casablanca", "Morocco Standard Time");
+ olsonTimeZoneToMs.put("Africa/Ceuta", "Romance Standard Time");
+ olsonTimeZoneToMs.put("Africa/Conakry", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Dakar", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Dar_es_Salaam", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Djibouti", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Douala", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/El_Aaiun", "Morocco Standard Time");
+ olsonTimeZoneToMs.put("Africa/Freetown", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Gaborone", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Harare", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Johannesburg", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Juba", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Kampala", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Khartoum", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Kigali", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Kinshasa", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Lagos", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Libreville", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Lome", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Luanda", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Lubumbashi", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Lusaka", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Malabo", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Maputo", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Maseru", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Mbabane", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Mogadishu", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Monrovia", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Nairobi", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Ndjamena", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Niamey", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Nouakchott", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Ouagadougou", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Porto-Novo", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Sao_Tome", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Timbuktu", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Africa/Tripoli", "Libya Standard Time");
+ olsonTimeZoneToMs.put("Africa/Tunis", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Africa/Windhoek", "Namibia Standard Time");
+ olsonTimeZoneToMs.put("America/Anchorage", "Alaskan Standard Time");
+ olsonTimeZoneToMs.put("America/Anguilla", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Antigua", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Araguaina", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Buenos_Aires", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Catamarca", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/ComodRivadavia", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Cordoba", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Jujuy", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/La_Rioja", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Mendoza", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Rio_Gallegos", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Salta", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/San_Juan", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/San_Luis", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Tucuman", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Argentina/Ushuaia", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Aruba", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Asuncion", "Paraguay Standard Time");
+ olsonTimeZoneToMs.put("America/Atikokan", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Bahia", "Bahia Standard Time");
+ olsonTimeZoneToMs.put("America/Bahia_Banderas", "Central Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Barbados", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Belem", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Belize", "Central America Standard Time");
+ olsonTimeZoneToMs.put("America/Blanc-Sablon", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Boa_Vista", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Bogota", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Boise", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Buenos_Aires", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Cambridge_Bay", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Campo_Grande", "Central Brazilian Standard Time");
+ olsonTimeZoneToMs.put("America/Cancun", "Eastern Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Caracas", "Venezuela Standard Time");
+ olsonTimeZoneToMs.put("America/Catamarca", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Cayenne", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Cayman", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Chicago", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Chihuahua", "Mountain Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Coral_Harbour", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Cordoba", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Costa_Rica", "Central America Standard Time");
+ olsonTimeZoneToMs.put("America/Creston", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Cuiaba", "Central Brazilian Standard Time");
+ olsonTimeZoneToMs.put("America/Curacao", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Danmarkshavn", "UTC");
+ olsonTimeZoneToMs.put("America/Dawson", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Dawson_Creek", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Denver", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Detroit", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Dominica", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Edmonton", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Eirunepe", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/El_Salvador", "Central America Standard Time");
+ olsonTimeZoneToMs.put("America/Ensenada", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Fort_Wayne", "US Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Fortaleza", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Glace_Bay", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("America/Godthab", "Greenland Standard Time");
+ olsonTimeZoneToMs.put("America/Goose_Bay", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("America/Grand_Turk", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Grenada", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Guadeloupe", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Guatemala", "Central America Standard Time");
+ olsonTimeZoneToMs.put("America/Guayaquil", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Guyana", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Halifax", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("America/Havana", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Hermosillo", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Indianapolis", "US Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Knox", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Marengo", "US Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Petersburg", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Tell_City", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Vevay", "US Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Vincennes", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Indiana/Winamac", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Indianapolis", "US Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Inuvik", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Iqaluit", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Jamaica", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Jujuy", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Juneau", "Alaskan Standard Time");
+ olsonTimeZoneToMs.put("America/Kentucky/Louisville", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Kentucky/Monticello", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Knox_IN", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Kralendijk", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/La_Paz", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Lima", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Los_Angeles", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Louisville", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Lower_Princes", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Maceio", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Managua", "Central America Standard Time");
+ olsonTimeZoneToMs.put("America/Manaus", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Marigot", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Martinique", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Matamoros", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Mazatlan", "Mountain Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Mendoza", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Menominee", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Merida", "Central Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Mexico_City", "Central Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Moncton", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("America/Monterrey", "Central Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Montevideo", "Montevideo Standard Time");
+ olsonTimeZoneToMs.put("America/Montreal", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Montserrat", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Nassau", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/New_York", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Nipigon", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Nome", "Alaskan Standard Time");
+ olsonTimeZoneToMs.put("America/Noronha", "UTC-02");
+ olsonTimeZoneToMs.put("America/North_Dakota/Beulah", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/North_Dakota/Center", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/North_Dakota/New_Salem", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Ojinaga", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Panama", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Pangnirtung", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Paramaribo", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Phoenix", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Port-au-Prince", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Port_of_Spain", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Porto_Acre", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Porto_Velho", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Puerto_Rico", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Rainy_River", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Rankin_Inlet", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Recife", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Regina", "Canada Central Standard Time");
+ olsonTimeZoneToMs.put("America/Resolute", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Rio_Branco", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Rosario", "Argentina Standard Time");
+ olsonTimeZoneToMs.put("America/Santa_Isabel", "Pacific Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("America/Santarem", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Santiago", "Pacific SA Standard Time");
+ olsonTimeZoneToMs.put("America/Santo_Domingo", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Sao_Paulo", "E. South America Standard Time");
+ olsonTimeZoneToMs.put("America/Scoresbysund", "Azores Standard Time");
+ olsonTimeZoneToMs.put("America/Shiprock", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("America/Sitka", "Alaskan Standard Time");
+ olsonTimeZoneToMs.put("America/St_Barthelemy", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/St_Johns", "Newfoundland Standard Time");
+ olsonTimeZoneToMs.put("America/St_Kitts", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/St_Lucia", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/St_Thomas", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/St_Vincent", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Swift_Current", "Canada Central Standard Time");
+ olsonTimeZoneToMs.put("America/Tegucigalpa", "Central America Standard Time");
+ olsonTimeZoneToMs.put("America/Thule", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("America/Thunder_Bay", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Tijuana", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Toronto", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("America/Tortola", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Vancouver", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Virgin", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("America/Whitehorse", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Winnipeg", "Central Standard Time");
+ olsonTimeZoneToMs.put("America/Yakutat", "Alaskan Standard Time");
+ olsonTimeZoneToMs.put("America/Yellowknife", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Casey", "W. Australia Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Davis", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/DumontDUrville", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Macquarie", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Mawson", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/McMurdo", "New Zealand Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Palmer", "Pacific SA Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Rothera", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/South_Pole", "New Zealand Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Syowa", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Antarctica/Vostok", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Arctic/Longyearbyen", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Asia/Aden", "Arab Standard Time");
+ olsonTimeZoneToMs.put("Asia/Almaty", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Amman", "Jordan Standard Time");
+ olsonTimeZoneToMs.put("Asia/Anadyr", "Russia Time Zone 11");
+ olsonTimeZoneToMs.put("Asia/Aqtau", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Aqtobe", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ashgabat", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ashkhabad", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Baghdad", "Arabic Standard Time");
+ olsonTimeZoneToMs.put("Asia/Bahrain", "Arab Standard Time");
+ olsonTimeZoneToMs.put("Asia/Baku", "Azerbaijan Standard Time");
+ olsonTimeZoneToMs.put("Asia/Bangkok", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Beirut", "Middle East Standard Time");
+ olsonTimeZoneToMs.put("Asia/Bishkek", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Brunei", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Calcutta", "India Standard Time");
+ olsonTimeZoneToMs.put("Asia/Chita", "North Asia East Standard Time");
+ olsonTimeZoneToMs.put("Asia/Choibalsan", "Ulaanbaatar Standard Time");
+ olsonTimeZoneToMs.put("Asia/Chongqing", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Chungking", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Colombo", "Sri Lanka Standard Time");
+ olsonTimeZoneToMs.put("Asia/Dacca", "Bangladesh Standard Time");
+ olsonTimeZoneToMs.put("Asia/Damascus", "Syria Standard Time");
+ olsonTimeZoneToMs.put("Asia/Dhaka", "Bangladesh Standard Time");
+ olsonTimeZoneToMs.put("Asia/Dili", "Tokyo Standard Time");
+ olsonTimeZoneToMs.put("Asia/Dubai", "Arabian Standard Time");
+ olsonTimeZoneToMs.put("Asia/Dushanbe", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Harbin", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ho_Chi_Minh", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Hong_Kong", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Hovd", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Irkutsk", "North Asia East Standard Time");
+ olsonTimeZoneToMs.put("Asia/Istanbul", "Turkey Standard Time");
+ olsonTimeZoneToMs.put("Asia/Jakarta", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Jayapura", "Tokyo Standard Time");
+ olsonTimeZoneToMs.put("Asia/Jerusalem", "Israel Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kabul", "Afghanistan Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kamchatka", "Russia Time Zone 11");
+ olsonTimeZoneToMs.put("Asia/Karachi", "Pakistan Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kashgar", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kathmandu", "Nepal Standard Time");
+ olsonTimeZoneToMs.put("Asia/Katmandu", "Nepal Standard Time");
+ olsonTimeZoneToMs.put("Asia/Khandyga", "Yakutsk Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kolkata", "India Standard Time");
+ olsonTimeZoneToMs.put("Asia/Krasnoyarsk", "North Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kuala_Lumpur", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kuching", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Kuwait", "Arab Standard Time");
+ olsonTimeZoneToMs.put("Asia/Macao", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Macau", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Magadan", "Magadan Standard Time");
+ olsonTimeZoneToMs.put("Asia/Makassar", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Manila", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Muscat", "Arabian Standard Time");
+ olsonTimeZoneToMs.put("Asia/Nicosia", "GTB Standard Time");
+ olsonTimeZoneToMs.put("Asia/Novokuznetsk", "North Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Novosibirsk", "N. Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Omsk", "N. Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Oral", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Phnom_Penh", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Pontianak", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Pyongyang", "Korea Standard Time");
+ olsonTimeZoneToMs.put("Asia/Qatar", "Arab Standard Time");
+ olsonTimeZoneToMs.put("Asia/Qyzylorda", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Rangoon", "Myanmar Standard Time");
+ olsonTimeZoneToMs.put("Asia/Riyadh", "Arab Standard Time");
+ olsonTimeZoneToMs.put("Asia/Saigon", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Sakhalin", "Vladivostok Standard Time");
+ olsonTimeZoneToMs.put("Asia/Samarkand", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Seoul", "Korea Standard Time");
+ olsonTimeZoneToMs.put("Asia/Shanghai", "China Standard Time");
+ olsonTimeZoneToMs.put("Asia/Singapore", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Srednekolymsk", "Russia Time Zone 10");
+ olsonTimeZoneToMs.put("Asia/Taipei", "Taipei Standard Time");
+ olsonTimeZoneToMs.put("Asia/Tashkent", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Tbilisi", "Georgian Standard Time");
+ olsonTimeZoneToMs.put("Asia/Tehran", "Iran Standard Time");
+ olsonTimeZoneToMs.put("Asia/Tel_Aviv", "Israel Standard Time");
+ olsonTimeZoneToMs.put("Asia/Thimbu", "Bangladesh Standard Time");
+ olsonTimeZoneToMs.put("Asia/Thimphu", "Bangladesh Standard Time");
+ olsonTimeZoneToMs.put("Asia/Tokyo", "Tokyo Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ujung_Pandang", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ulaanbaatar", "Ulaanbaatar Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ulan_Bator", "Ulaanbaatar Standard Time");
+ olsonTimeZoneToMs.put("Asia/Urumqi", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Ust-Nera", "Vladivostok Standard Time");
+ olsonTimeZoneToMs.put("Asia/Vientiane", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Asia/Vladivostok", "Vladivostok Standard Time");
+ olsonTimeZoneToMs.put("Asia/Yakutsk", "Yakutsk Standard Time");
+ olsonTimeZoneToMs.put("Asia/Yekaterinburg", "Ekaterinburg Standard Time");
+ olsonTimeZoneToMs.put("Asia/Yerevan", "Caucasus Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Azores", "Azores Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Bermuda", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Canary", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Cape_Verde", "Cape Verde Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Faeroe", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Faroe", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Jan_Mayen", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Madeira", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Reykjavik", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/South_Georgia", "UTC-02");
+ olsonTimeZoneToMs.put("Atlantic/St_Helena", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Atlantic/Stanley", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/ACT", "AUS Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/Adelaide", "Cen. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Brisbane", "E. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Broken_Hill", "Cen. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Canberra", "AUS Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/Currie", "Tasmania Standard Time");
+ olsonTimeZoneToMs.put("Australia/Darwin", "AUS Central Standard Time");
+ olsonTimeZoneToMs.put("Australia/Hobart", "Tasmania Standard Time");
+ olsonTimeZoneToMs.put("Australia/Lindeman", "E. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Melbourne", "AUS Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/NSW", "AUS Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/North", "AUS Central Standard Time");
+ olsonTimeZoneToMs.put("Australia/Perth", "W. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Queensland", "E. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/South", "Cen. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Sydney", "AUS Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/Tasmania", "Tasmania Standard Time");
+ olsonTimeZoneToMs.put("Australia/Victoria", "AUS Eastern Standard Time");
+ olsonTimeZoneToMs.put("Australia/West", "W. Australia Standard Time");
+ olsonTimeZoneToMs.put("Australia/Yancowinna", "Cen. Australia Standard Time");
+ olsonTimeZoneToMs.put("Brazil/Acre", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("Brazil/DeNoronha", "UTC-02");
+ olsonTimeZoneToMs.put("Brazil/East", "E. South America Standard Time");
+ olsonTimeZoneToMs.put("Brazil/West", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("CST6CDT", "Central Standard Time");
+ olsonTimeZoneToMs.put("Canada/Atlantic", "Atlantic Standard Time");
+ olsonTimeZoneToMs.put("Canada/Central", "Central Standard Time");
+ olsonTimeZoneToMs.put("Canada/East-Saskatchewan", "Canada Central Standard Time");
+ olsonTimeZoneToMs.put("Canada/Eastern", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("Canada/Mountain", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("Canada/Newfoundland", "Newfoundland Standard Time");
+ olsonTimeZoneToMs.put("Canada/Pacific", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("Canada/Saskatchewan", "Canada Central Standard Time");
+ olsonTimeZoneToMs.put("Canada/Yukon", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("Chile/Continental", "Pacific SA Standard Time");
+ olsonTimeZoneToMs.put("Cuba", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("EST", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("EST5EDT", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("Egypt", "Egypt Standard Time");
+ olsonTimeZoneToMs.put("Eire", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT", "UTC");
+ olsonTimeZoneToMs.put("Etc/GMT+0", "UTC");
+ olsonTimeZoneToMs.put("Etc/GMT+1", "Cape Verde Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+10", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+11", "UTC-11");
+ olsonTimeZoneToMs.put("Etc/GMT+12", "Dateline Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+2", "UTC-02");
+ olsonTimeZoneToMs.put("Etc/GMT+3", "SA Eastern Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+4", "SA Western Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+5", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+6", "Central America Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT+7", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-0", "UTC");
+ olsonTimeZoneToMs.put("Etc/GMT-1", "W. Central Africa Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-10", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-11", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-12", "UTC+12");
+ olsonTimeZoneToMs.put("Etc/GMT-13", "Tonga Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-14", "Line Islands Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-2", "South Africa Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-3", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-4", "Arabian Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-5", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-6", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-7", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-8", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT-9", "Tokyo Standard Time");
+ olsonTimeZoneToMs.put("Etc/GMT0", "UTC");
+ olsonTimeZoneToMs.put("Etc/Greenwich", "UTC");
+ olsonTimeZoneToMs.put("Etc/UCT", "UTC");
+ olsonTimeZoneToMs.put("Etc/UTC", "UTC");
+ olsonTimeZoneToMs.put("Etc/Universal", "UTC");
+ olsonTimeZoneToMs.put("Etc/Zulu", "UTC");
+ olsonTimeZoneToMs.put("Europe/Amsterdam", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Andorra", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Athens", "GTB Standard Time");
+ olsonTimeZoneToMs.put("Europe/Belfast", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Belgrade", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Berlin", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Bratislava", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Brussels", "Romance Standard Time");
+ olsonTimeZoneToMs.put("Europe/Bucharest", "GTB Standard Time");
+ olsonTimeZoneToMs.put("Europe/Budapest", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Busingen", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Chisinau", "GTB Standard Time");
+ olsonTimeZoneToMs.put("Europe/Copenhagen", "Romance Standard Time");
+ olsonTimeZoneToMs.put("Europe/Dublin", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Gibraltar", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Guernsey", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Helsinki", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Isle_of_Man", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Istanbul", "Turkey Standard Time");
+ olsonTimeZoneToMs.put("Europe/Jersey", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Kaliningrad", "Kaliningrad Standard Time");
+ olsonTimeZoneToMs.put("Europe/Kiev", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Lisbon", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Ljubljana", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/London", "GMT Standard Time");
+ olsonTimeZoneToMs.put("Europe/Luxembourg", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Madrid", "Romance Standard Time");
+ olsonTimeZoneToMs.put("Europe/Malta", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Mariehamn", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Minsk", "Belarus Standard Time");
+ olsonTimeZoneToMs.put("Europe/Monaco", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Moscow", "Russian Standard Time");
+ olsonTimeZoneToMs.put("Europe/Nicosia", "GTB Standard Time");
+ olsonTimeZoneToMs.put("Europe/Oslo", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Paris", "Romance Standard Time");
+ olsonTimeZoneToMs.put("Europe/Podgorica", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Prague", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Riga", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Rome", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Samara", "Russia Time Zone 3");
+ olsonTimeZoneToMs.put("Europe/San_Marino", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Sarajevo", "Central European Standard Time");
+ olsonTimeZoneToMs.put("Europe/Simferopol", "Russian Standard Time");
+ olsonTimeZoneToMs.put("Europe/Skopje", "Central European Standard Time");
+ olsonTimeZoneToMs.put("Europe/Sofia", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Stockholm", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Tallinn", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Tirane", "Central Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Tiraspol", "GTB Standard Time");
+ olsonTimeZoneToMs.put("Europe/Uzhgorod", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Vaduz", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Vatican", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Vienna", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("Europe/Vilnius", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Volgograd", "Russian Standard Time");
+ olsonTimeZoneToMs.put("Europe/Warsaw", "Central European Standard Time");
+ olsonTimeZoneToMs.put("Europe/Zagreb", "Central European Standard Time");
+ olsonTimeZoneToMs.put("Europe/Zaporozhye", "FLE Standard Time");
+ olsonTimeZoneToMs.put("Europe/Zurich", "W. Europe Standard Time");
+ olsonTimeZoneToMs.put("GB", "GMT Standard Time");
+ olsonTimeZoneToMs.put("GB-Eire", "GMT Standard Time");
+ olsonTimeZoneToMs.put("GMT", "UTC");
+ olsonTimeZoneToMs.put("GMT+0", "UTC");
+ olsonTimeZoneToMs.put("GMT-0", "UTC");
+ olsonTimeZoneToMs.put("GMT0", "UTC");
+ olsonTimeZoneToMs.put("Greenwich", "UTC");
+ olsonTimeZoneToMs.put("HST", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("Hongkong", "China Standard Time");
+ olsonTimeZoneToMs.put("Iceland", "Greenwich Standard Time");
+ olsonTimeZoneToMs.put("Indian/Antananarivo", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Indian/Chagos", "Central Asia Standard Time");
+ olsonTimeZoneToMs.put("Indian/Christmas", "SE Asia Standard Time");
+ olsonTimeZoneToMs.put("Indian/Cocos", "Myanmar Standard Time");
+ olsonTimeZoneToMs.put("Indian/Comoro", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Indian/Kerguelen", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Indian/Mahe", "Mauritius Standard Time");
+ olsonTimeZoneToMs.put("Indian/Maldives", "West Asia Standard Time");
+ olsonTimeZoneToMs.put("Indian/Mauritius", "Mauritius Standard Time");
+ olsonTimeZoneToMs.put("Indian/Mayotte", "E. Africa Standard Time");
+ olsonTimeZoneToMs.put("Indian/Reunion", "Mauritius Standard Time");
+ olsonTimeZoneToMs.put("Iran", "Iran Standard Time");
+ olsonTimeZoneToMs.put("Israel", "Israel Standard Time");
+ olsonTimeZoneToMs.put("Jamaica", "SA Pacific Standard Time");
+ olsonTimeZoneToMs.put("Japan", "Tokyo Standard Time");
+ olsonTimeZoneToMs.put("Kwajalein", "UTC+12");
+ olsonTimeZoneToMs.put("Libya", "Libya Standard Time");
+ olsonTimeZoneToMs.put("MST", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("MST7MDT", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("Mexico/BajaNorte", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("Mexico/BajaSur", "Mountain Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("Mexico/General", "Central Standard Time (Mexico)");
+ olsonTimeZoneToMs.put("NZ", "New Zealand Standard Time");
+ olsonTimeZoneToMs.put("Navajo", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("PRC", "China Standard Time");
+ olsonTimeZoneToMs.put("PST8PDT", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Apia", "Samoa Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Auckland", "New Zealand Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Bougainville", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Chuuk", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Efate", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Enderbury", "Tonga Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Fakaofo", "Tonga Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Fiji", "Fiji Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Funafuti", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Galapagos", "Central America Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Guadalcanal", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Guam", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Honolulu", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Johnston", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Kiritimati", "Line Islands Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Kosrae", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Kwajalein", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Majuro", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Midway", "UTC-11");
+ olsonTimeZoneToMs.put("Pacific/Nauru", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Niue", "UTC-11");
+ olsonTimeZoneToMs.put("Pacific/Noumea", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Pago_Pago", "UTC-11");
+ olsonTimeZoneToMs.put("Pacific/Palau", "Tokyo Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Pohnpei", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Ponape", "Central Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Port_Moresby", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Rarotonga", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Saipan", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Samoa", "UTC-11");
+ olsonTimeZoneToMs.put("Pacific/Tahiti", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Tarawa", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Tongatapu", "Tonga Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Truk", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Pacific/Wake", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Wallis", "UTC+12");
+ olsonTimeZoneToMs.put("Pacific/Yap", "West Pacific Standard Time");
+ olsonTimeZoneToMs.put("Poland", "Central European Standard Time");
+ olsonTimeZoneToMs.put("Portugal", "GMT Standard Time");
+ olsonTimeZoneToMs.put("ROC", "Taipei Standard Time");
+ olsonTimeZoneToMs.put("ROK", "Korea Standard Time");
+ olsonTimeZoneToMs.put("Singapore", "Singapore Standard Time");
+ olsonTimeZoneToMs.put("Turkey", "Turkey Standard Time");
+ olsonTimeZoneToMs.put("UCT", "UTC");
+ olsonTimeZoneToMs.put("US/Alaska", "Alaskan Standard Time");
+ olsonTimeZoneToMs.put("US/Arizona", "US Mountain Standard Time");
+ olsonTimeZoneToMs.put("US/Central", "Central Standard Time");
+ olsonTimeZoneToMs.put("US/East-Indiana", "US Eastern Standard Time");
+ olsonTimeZoneToMs.put("US/Eastern", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("US/Hawaii", "Hawaiian Standard Time");
+ olsonTimeZoneToMs.put("US/Indiana-Starke", "Central Standard Time");
+ olsonTimeZoneToMs.put("US/Michigan", "Eastern Standard Time");
+ olsonTimeZoneToMs.put("US/Mountain", "Mountain Standard Time");
+ olsonTimeZoneToMs.put("US/Pacific", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("US/Pacific-New", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("US/Samoa", "UTC-11");
+ olsonTimeZoneToMs.put("UTC", "UTC");
+ olsonTimeZoneToMs.put("Universal", "UTC");
+ olsonTimeZoneToMs.put("W-SU", "Russian Standard Time");
+ olsonTimeZoneToMs.put("Zulu", "UTC");
+ //additions outside of Unicode list
+ olsonTimeZoneToMs.put("America/Adak", "Hawaiian Standard Time,(UTC-10:00) Hawaii");
+ olsonTimeZoneToMs.put("America/Atka", "Hawaiian Standard Time,(UTC-10:00) Hawaii");
+ olsonTimeZoneToMs.put("America/Metlakatla", "Pacific Standard Time");
+ olsonTimeZoneToMs.put("America/Miquelon", "South America Standard Time");
+ olsonTimeZoneToMs.put("Asia/Gaza", "Middle East Standard Time");
+ }
+
+ /**
+ * Convert Olson TimeZone to Microsoft TimeZone Generated using Unicode CLDR project Example:
+ * https://gist.github.com/scottmac/655675e9b4d4913c539c
+ *
+ * @param timeZone java timezone (Olson)
+ * @return a microsoft timezone identifier (ala Eastern Standard Time)
+ */
+ public static String getMicrosoftTimeZoneName(TimeZone timeZone) {
+ return olsonTimeZoneToMs.get(timeZone.getID());
+ }
+
+}
diff --git a/src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java b/src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java
new file mode 100644
index 000000000..cc183304d
--- /dev/null
+++ b/src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java
@@ -0,0 +1,50 @@
+/*
+ * The MIT License
+ * Copyright (c) 2012 Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package microsoft.exchange.webservices.data.property.complex;
+
+import microsoft.exchange.webservices.data.property.complex.time.OlsonTimeZoneDefinition;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.util.TimeZone;
+
+@RunWith(JUnit4.class)
+public class OlsonTimeZoneTest {
+
+ @Test
+ public void testOlsonTimeZoneConversion() {
+ final String[] timeZoneIds = TimeZone.getAvailableIDs();
+ for (String timeZoneId : timeZoneIds) {
+ if(timeZoneId.startsWith("America") || timeZoneId.startsWith("Europe") || timeZoneId.startsWith("Africa")) {
+ //there are a few timezones that are out of date or don't have direct microsoft mappings according to the Unicode source we use so we will only test Americas, Europe and Africa
+ final OlsonTimeZoneDefinition olsonTimeZone = new OlsonTimeZoneDefinition(TimeZone.getTimeZone(timeZoneId));
+ Assert.assertNotNull(olsonTimeZone.getId());
+ }
+
+ }
+
+ }
+}
From d1ba4ee8ddafd4c618ba92dbe86de46d72164eb1 Mon Sep 17 00:00:00 2001
From: Erik van Paassen
Date: Thu, 1 Oct 2015 14:18:40 +0200
Subject: [PATCH 09/37] Backport TimeZoneUtils from main.
---
.../{property/complex/time => }/OlsonTimeZoneDefinition.java | 5 ++---
.../data/{property/complex => }/OlsonTimeZoneTest.java | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)
rename src/main/java/microsoft/exchange/webservices/data/{property/complex/time => }/OlsonTimeZoneDefinition.java (93%)
rename src/test/java/microsoft/exchange/webservices/data/{property/complex => }/OlsonTimeZoneTest.java (92%)
diff --git a/src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java b/src/main/java/microsoft/exchange/webservices/data/OlsonTimeZoneDefinition.java
similarity index 93%
rename from src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java
rename to src/main/java/microsoft/exchange/webservices/data/OlsonTimeZoneDefinition.java
index 08316475f..86a5dc375 100644
--- a/src/main/java/microsoft/exchange/webservices/data/property/complex/time/OlsonTimeZoneDefinition.java
+++ b/src/main/java/microsoft/exchange/webservices/data/OlsonTimeZoneDefinition.java
@@ -21,10 +21,9 @@
* THE SOFTWARE.
*/
-package microsoft.exchange.webservices.data.property.complex.time;
+package microsoft.exchange.webservices.data;
-import microsoft.exchange.webservices.data.exception.ServiceLocalException;
import microsoft.exchange.webservices.data.util.TimeZoneUtils;
import java.util.Date;
@@ -53,4 +52,4 @@ public void validate() throws ServiceLocalException {
throw new ServiceLocalException("Invalid TimeZone (" + this.name + ") Specified");
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java b/src/test/java/microsoft/exchange/webservices/data/OlsonTimeZoneTest.java
similarity index 92%
rename from src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java
rename to src/test/java/microsoft/exchange/webservices/data/OlsonTimeZoneTest.java
index cc183304d..19079e204 100644
--- a/src/test/java/microsoft/exchange/webservices/data/property/complex/OlsonTimeZoneTest.java
+++ b/src/test/java/microsoft/exchange/webservices/data/OlsonTimeZoneTest.java
@@ -21,9 +21,8 @@
* THE SOFTWARE.
*/
-package microsoft.exchange.webservices.data.property.complex;
+package microsoft.exchange.webservices.data;
-import microsoft.exchange.webservices.data.property.complex.time.OlsonTimeZoneDefinition;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
From 2019da5749781232edd0ca357fdd3ee5b3d67a47 Mon Sep 17 00:00:00 2001
From: Erik van Paassen
Date: Thu, 1 Oct 2015 14:19:17 +0200
Subject: [PATCH 10/37] Bump version to 2.0-eveoh12.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e626b02aa..9137da9dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh11
+ 2.0-eveoh12Exchange Web Services Java APIExchange Web Services (EWS) Java API
From f9b08aff2e68115d3c97d2fc4e56cca9c8946dff Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 19 Nov 2015 15:32:38 +0100
Subject: [PATCH 11/37] Fix discovery channel (HD).
---
.../exchange/webservices/data/AutodiscoverService.java | 4 ++--
.../exchange/webservices/data/ExchangeServiceBase.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index f97c958ec..d94cf67e7 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -352,7 +352,7 @@ private URI getRedirectUrl(String domainName)
HttpWebRequest request = null;
try {
- request = new HttpClientWebRequest(httpClient, httpContext);
+ request = new HttpClientWebRequest(getHttpClient(), httpContext);
try {
request.setUrl(URI.create(url).toURL());
@@ -1486,7 +1486,7 @@ private boolean tryGetEnabledEndpointsForHost(String host,
HttpWebRequest request = null;
try {
- request = new HttpClientWebRequest(httpClient, httpContext);
+ request = new HttpClientWebRequest(getHttpClient(), httpContext);
try {
request.setUrl(autoDiscoverUrl.toURL());
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index 0973ae09d..231667dad 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -134,7 +134,7 @@ public abstract class ExchangeServiceBase implements Closeable {
private WebProxy webProxy;
- protected CloseableHttpClient httpClient;
+ private CloseableHttpClient httpClient;
protected HttpClientContext httpContext;
@@ -180,7 +180,7 @@ protected ExchangeServiceBase(ExchangeServiceBase service, ExchangeVersion reque
this.sslConnectionSocketFactory = service.getSslConnectionSocketFactory();
}
- private CloseableHttpClient getHttpClient() {
+ protected CloseableHttpClient getHttpClient() {
if (httpClient == null) {
Registry
registry =
From a70b5bd5b78a82c43b885afe49cfa27e1763d29d Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 19 Nov 2015 15:33:04 +0100
Subject: [PATCH 12/37] Version eveoh13
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 9137da9dc..ace33d0b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh12
+ 2.0-eveoh13Exchange Web Services Java APIExchange Web Services (EWS) Java API
From 4e0d66ed80b30fb75740347a05088212625a9548 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 19 Nov 2015 15:43:37 +0100
Subject: [PATCH 13/37] Properly close httpclient.
---
.../webservices/data/ExchangeServiceBase.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index 231667dad..d4f85b64c 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -217,11 +217,14 @@ private void initializeHttpContext() {
@Override
public void close() {
- try {
- httpClient.close();
- } catch (IOException e) {
- // Ignore exceptions while closing the HttpClient.
- }
+ if (httpClient != null) {
+ try {
+ httpClient.close();
+ } catch (IOException e) {
+ // Ignore exceptions while closing the HttpClient.
+ }
+ httpClient = null;
+ }
}
// Event handlers
From f2888be58a58da55715c84d49a4b1a720563268d Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 19 Nov 2015 15:43:53 +0100
Subject: [PATCH 14/37] Version eveoh14.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index ace33d0b8..c8bcad133 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh13
+ 2.0-eveoh14Exchange Web Services Java APIExchange Web Services (EWS) Java API
From d648b0354eea29789e987aa4d057daa427633f2f Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 7 Jan 2016 11:49:00 +0100
Subject: [PATCH 15/37] Fix exception wrapping in SimpleServiceRequestBase
---
.../exchange/webservices/data/SimpleServiceRequestBase.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/SimpleServiceRequestBase.java b/src/main/java/microsoft/exchange/webservices/data/SimpleServiceRequestBase.java
index fb265f453..7ae17b10f 100644
--- a/src/main/java/microsoft/exchange/webservices/data/SimpleServiceRequestBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/SimpleServiceRequestBase.java
@@ -60,8 +60,7 @@ protected T internalExecute() throws ServiceLocalException, Exception {
return this.readResponse(response);
} catch (IOException ex) {
// Wrap exception.
- throw new ServiceRequestException(String.
- format(Strings.ServiceRequestFailed, ex.getMessage(), ex));
+ throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed, ex.getMessage()), ex);
} catch (Exception e) {
if (response != null) {
this.getService().processHttpResponseHeaders(TraceFlags.
From cd94091aaea4e28c881b0d964209bea04c326a82 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 7 Jan 2016 11:49:36 +0100
Subject: [PATCH 16/37] Update version to 2.0-eveoh15
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c8bcad133..c100ba0d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh14
+ 2.0-eveoh15Exchange Web Services Java APIExchange Web Services (EWS) Java API
From aa23707f01ef962839f86f8f96ee73e064de113f Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 7 Jan 2016 15:25:30 +0100
Subject: [PATCH 17/37] Reset auth state is authentication previously failed If
we do not reset the auth state we will keep failing, as HttpClient does not
retry authentication once it has failed
See eveoh/mytimetable#2088
---
.../exchange/webservices/data/HttpClientWebRequest.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java b/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java
index 7d31c9b21..4d2dce876 100644
--- a/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java
+++ b/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java
@@ -26,6 +26,7 @@
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
+import org.apache.http.auth.AuthProtocolState;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.NTCredentials;
import org.apache.http.client.CredentialsProvider;
@@ -148,6 +149,14 @@ public void prepareConnection() {
httpContext.setCredentialsProvider(credentialsProvider);
+ // Reset auth state is authentication previously failed, otherwise we will keep failing,
+ // as HttpClient does not retry authentication once it has failed
+ // See eveoh/mytimetable#2088
+ if (httpContext.getTargetAuthState() != null &&
+ httpContext.getTargetAuthState().getState() == AuthProtocolState.FAILURE) {
+ httpContext.getTargetAuthState().reset();
+ }
+
httpPost.setConfig(requestConfigBuilder.build());
}
From 3cea0140f8fc9a5f0358d205df83e8864f1c78f9 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 7 Jan 2016 15:26:30 +0100
Subject: [PATCH 18/37] Up version to 2.0-eveoh16
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c100ba0d5..04ed1baaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh15
+ 2.0-eveoh16Exchange Web Services Java APIExchange Web Services (EWS) Java API
From dbff6cd1d3a9273482a9f94b2f8723b5e0d3d824 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Tue, 17 Oct 2017 20:15:04 +0200
Subject: [PATCH 19/37] Set default HttpClient request timeout to 300s.
---
.../webservices/data/ExchangeServiceBase.java | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index d4f85b64c..39d3ce8c4 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -24,6 +24,7 @@
package microsoft.exchange.webservices.data;
import org.apache.http.client.CookieStore;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
@@ -37,10 +38,9 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
@@ -48,15 +48,15 @@
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.TimeZone;
/**
* Represents an abstract binding to an Exchange Service.
@@ -193,10 +193,15 @@ protected CloseableHttpClient getHttpClient() {
.getSocketFactory()).build();
HttpClientConnectionManager httpConnectionManager = new BasicHttpClientConnectionManager(registry);
+ RequestConfig
+ requestConfig =
+ RequestConfig.custom().setConnectionRequestTimeout(300000).setConnectTimeout(3000000)
+ .setSocketTimeout(300000).build();
HttpClientBuilder
httpClientBuilder =
HttpClients.custom().setConnectionManager(httpConnectionManager)
- .setTargetAuthenticationStrategy(new CookieProcessingTargetAuthenticationStrategy());
+ .setTargetAuthenticationStrategy(new CookieProcessingTargetAuthenticationStrategy())
+ .setDefaultRequestConfig(requestConfig);
if (!acceptGzipEncoding) {
httpClientBuilder.disableContentCompression();
From 277d5d628b271f92880badaca233e1864b4739e1 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Tue, 17 Oct 2017 20:16:37 +0200
Subject: [PATCH 20/37] Up version to 2.0-eveoh17.
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 04ed1baaa..196495a74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh16
+ 2.0-eveoh17Exchange Web Services Java APIExchange Web Services (EWS) Java API
From 618696a0bf8c618a9c82b4f5fc1d4382aae6a193 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Thu, 9 Nov 2017 17:36:06 +0100
Subject: [PATCH 21/37] Remove useless code/comments from AutodiscoverService.
---
.../webservices/data/AutodiscoverService.java | 410 +++---------------
1 file changed, 65 insertions(+), 345 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index d94cf67e7..0acae5286 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -23,15 +23,22 @@
package microsoft.exchange.webservices.data;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import javax.xml.stream.XMLStreamException;
-import java.io.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.List;
/**
* Represents a binding to the Exchange Autodiscover Service.
@@ -39,9 +46,6 @@
public final class AutodiscoverService extends ExchangeServiceBase implements
IAutodiscoverRedirectionUrl, IFunctionDelegate {
- private static final Log log = LogFactory.getLog(AutodiscoverService.class);
-
- // region Private members
/**
* The domain.
*/
@@ -78,98 +82,56 @@ public final class AutodiscoverService extends ExchangeServiceBase implements
*/
private boolean enableScpLookup = true;
- // Autodiscover legacy path
/**
- * The Constant AutodiscoverLegacyPath.
+ * Autodiscover legacy path
*/
private static final String AutodiscoverLegacyPath =
"/autodiscover/autodiscover.xml";
- // Autodiscover legacy HTTPS Url
/**
- * The Constant AutodiscoverLegacyHttpsUrl.
+ * Autodiscover legacy HTTPS Url
*/
private static final String AutodiscoverLegacyHttpsUrl = "https://%s" +
AutodiscoverLegacyPath;
- // Autodiscover legacy HTTP Url
+
/**
- * The Constant AutodiscoverLegacyHttpUrl.
+ * Autodiscover legacy HTTP Url
*/
private static final String AutodiscoverLegacyHttpUrl = "http://%s" +
AutodiscoverLegacyPath;
- // Autodiscover SOAP HTTPS Url
+
/**
- * The Constant AutodiscoverSoapHttpsUrl.
+ * Autodiscover SOAP HTTPS Url
*/
private static final String AutodiscoverSoapHttpsUrl =
"https://%s/autodiscover/autodiscover.svc";
- // Autodiscover SOAP WS-Security HTTPS Url
- /**
- * The Constant AutodiscoverSoapWsSecurityHttpsUrl.
- */
- private static final String AutodiscoverSoapWsSecurityHttpsUrl =
- AutodiscoverSoapHttpsUrl +
- "/wssecurity";
-
- /**
- * Autodiscover SOAP WS-Security symmetrickey HTTPS Url
- */
- private static final String AutodiscoverSoapWsSecuritySymmetricKeyHttpsUrl =
- AutodiscoverSoapHttpsUrl + "/wssecurity/symmetrickey";
/**
- * Autodiscover SOAP WS-Security x509cert HTTPS Url
- */
- private static final String AutodiscoverSoapWsSecurityX509CertHttpsUrl =
- AutodiscoverSoapHttpsUrl + "/wssecurity/x509cert";
-
-
- // Autodiscover request namespace
- /**
- * The Constant AutodiscoverRequestNamespace.
+ * Autodiscover request namespace
*/
private static final String AutodiscoverRequestNamespace =
"http://schemas.microsoft.com/exchange/autodiscover/" +
"outlook/requestschema/2006";
- // Maximum number of Url (or address) redirections that will be followed by
- // an Autodiscover call
+
/**
- * The Constant AutodiscoverMaxRedirections.
+ * Maximum number of Url (or address) redirections that will be followed by an Autodiscover call
*/
- protected static final int AutodiscoverMaxRedirections = 10;
- // HTTP header indicating that SOAP Autodiscover service is enabled.
+ private static final int AutodiscoverMaxRedirections = 10;
+
/**
- * The Constant AutodiscoverSoapEnabledHeaderName.
+ * HTTP header indicating that SOAP Autodiscover service is enabled.
*/
private static final String AutodiscoverSoapEnabledHeaderName =
"X-SOAP-Enabled";
- // HTTP header indicating that WS-Security Autodiscover service is enabled.
+
/**
- * The Constant AutodiscoverWsSecurityEnabledHeaderName.
+ * HTTP header indicating that WS-Security Autodiscover service is enabled.
*/
private static final String AutodiscoverWsSecurityEnabledHeaderName =
"X-WSSecurity-Enabled";
-
/**
- * HTTP header indicating that WS-Security/SymmetricKey Autodiscover service is enabled.
- */
-
- private static final String AutodiscoverWsSecuritySymmetricKeyEnabledHeaderName =
- "X-WSSecurity-SymmetricKey-Enabled";
-
-
- /**
- * HTTP header indicating that WS-Security/X509Cert Autodiscover service is enabled.
- */
-
- private static final String AutodiscoverWsSecurityX509CertEnabledHeaderName =
- "X-WSSecurity-X509Cert-Enabled";
-
-
- // Minimum request version for Autodiscover SOAP service.
- /**
- * The Constant MinimumRequestVersionForAutoDiscoverSoapService.
+ * Minimum request version for Autodiscover SOAP service.
*/
private static final ExchangeVersion
MinimumRequestVersionForAutoDiscoverSoapService =
@@ -221,8 +183,6 @@ TSettings getLegacyUserSettingsAtUrl(
this.traceHttpRequestHeaders(
TraceFlags.AutodiscoverRequestHttpHeaders,
request);
- // OutputStreamWriter out = new
- // OutputStreamWriter(request.getOutputStream());
OutputStream urlOutStream = request.getOutputStream();
// If tracing is enabled, we generate the request in-memory so that we
@@ -236,8 +196,6 @@ TSettings getLegacyUserSettingsAtUrl(
writer.flush();
this.traceXml(TraceFlags.AutodiscoverRequest, memoryStream);
- // out.write(memoryStream.toString());
- // out.close();
memoryStream.writeTo(urlOutStream);
urlOutStream.flush();
urlOutStream.close();
@@ -246,11 +204,9 @@ TSettings getLegacyUserSettingsAtUrl(
PrintWriter writer = new PrintWriter(urlOutStream);
this.writeLegacyAutodiscoverRequest(emailAddress, settings, writer);
- /* Flush Start */
writer.flush();
urlOutStream.flush();
urlOutStream.close();
- /* Flush End */
}
request.executeRequest();
request.getResponseCode();
@@ -262,11 +218,9 @@ TSettings getLegacyUserSettingsAtUrl(
return settings;
}
InputStream serviceResponseStream = request.getInputStream();
- // If tracing is enabled, we read the entire response into a
- // MemoryStream so that we
+ // If tracing is enabled, we read the entire response into a MemoryStream so that we
// can pass it along to the ITraceListener. Then we parse the response
- // from the
- // MemoryStream.
+ // from the MemoryStream.
if (this.isTraceEnabledFor(TraceFlags.AutodiscoverResponse)) {
ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
@@ -298,8 +252,7 @@ TSettings getLegacyUserSettingsAtUrl(
if (request != null) {
try {
request.close();
- } catch (Exception e2) {
- // Ignore exceptions while closing the request.
+ } catch (Exception ignored) {
}
}
}
@@ -385,8 +338,7 @@ private URI getRedirectUrl(String domainName)
if (request != null) {
try {
request.close();
- } catch (Exception e) {
- // Ignore exceptions when closing the request
+ } catch (Exception ignored) {
}
}
}
@@ -454,13 +406,8 @@ private boolean tryGetRedirectionResponse(HttpWebRequest request,
* @return The requested configuration settings.
* @throws Exception the exception
*/
- protected
- TSettings getLegacyUserSettings(
- Class cls, String emailAddress) throws Exception {
- /*int currentHop = 1;
- return this.internalGetConfigurationSettings(cls, emailAddress,
- currentHop);*/
-
+ private
+ TSettings getLegacyUserSettings(Class cls, String emailAddress) throws Exception {
// If Url is specified, call service directly.
if (this.url != null) {
// this.Uri is intended for Autodiscover SOAP service, convert to Legacy endpoint URL.
@@ -517,10 +464,8 @@ TSettings internalGetLegacyUserSettings(
}
// Assume caller is not inside the Intranet, regardless of whether SCP
- // Urls
- // were returned or not. SCP Urls are only relevent if one of them
- // returns
- // valid Autodiscover settings.
+ // Urls were returned or not. SCP Urls are only relevent if one of them
+ // returns valid Autodiscover settings.
this.isExternal = true;
int currentUrlIndex = 0;
@@ -646,32 +591,12 @@ TSettings internalGetLegacyUserSettings(
// The content at the URL wasn't a valid response, let's try the next.
currentUrlIndex++;
} catch (Exception ex) {
- HttpWebRequest response = null;
- URI redirectUrl;
- OutParam outParam1 = new OutParam();
- if ((response != null) &&
- this.tryGetRedirectionResponse(response, outParam1)) {
- redirectUrl = outParam1.getParam();
- this.traceMessage(TraceFlags.AutodiscoverConfiguration,
- String.format(
- "Host returned a redirection to url %s",
- redirectUrl.toString()));
+ this.traceMessage(TraceFlags.AutodiscoverConfiguration,
+ String.format("%s failed: %s (%s)", url, ex
+ .getClass().getName(), ex.getMessage()));
- currentHop.setParam(currentHop.getParam() + 1);
- urls.add(currentUrlIndex, redirectUrl);
- } else {
- if (response != null) {
- this.processHttpErrorResponse(response, ex);
-
- }
-
- this.traceMessage(TraceFlags.AutodiscoverConfiguration,
- String.format("%s failed: %s (%s)", url, ex
- .getClass().getName(), ex.getMessage()));
-
- // The url did not work, let's try the next.
- currentUrlIndex++;
- }
+ // The url did not work, let's try the next.
+ currentUrlIndex++;
}
} while (currentUrlIndex < urls.size());
@@ -800,7 +725,6 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
emailAddress,
redirectionEmailAddresses,
outParam));
- currentHop = outParam.getParam();
return true;
case RedirectUrl:
try {
@@ -852,36 +776,13 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
redirectionUrl, ex.getMessage()));
return false;
} catch (Exception ex) {
- // TODO: BUG response is always null
- HttpWebRequest response = null;
- OutParam outParam = new OutParam();
- if ((response != null)
- && this.tryGetRedirectionResponse(response,
- outParam)) {
- redirectionUrl = outParam.getParam();
- this
- .traceMessage(
- TraceFlags.AutodiscoverConfiguration,
- String
- .format(
- "Host returned a " +
- "redirection" +
- " to url %s",
- redirectionUrl));
-
- } else {
- if (response != null) {
- this.processHttpErrorResponse(response, ex);
- }
-
- this
- .traceMessage(
- TraceFlags.AutodiscoverConfiguration,
- String.format("%s failed: %s (%s)",
- url, ex.getClass().getName(),
- ex.getMessage()));
- return false;
- }
+ this
+ .traceMessage(
+ TraceFlags.AutodiscoverConfiguration,
+ String.format("%s failed: %s (%s)",
+ url, ex.getClass().getName(),
+ ex.getMessage()));
+ return false;
}
}
}
@@ -915,16 +816,8 @@ private void disableScpLookupIfDuplicateRedirection(
* @param requestedSettings The requested settings.
* @return GetUserSettingsResponse
*/
- protected GetUserSettingsResponse internalGetLegacyUserSettings(
- String emailAddress,
+ private GetUserSettingsResponse internalGetLegacyUserSettings(String emailAddress,
List requestedSettings) throws Exception {
- // Cannot call legacy Autodiscover service with WindowsLive credentials
-
- /*if ((this.getCredentials() != null) && (this.getCredentials() instanceof WindowsLiveCredentials)) {
- throw new AutodiscoverLocalException(
- Strings.WLIDCredentialsCannotBeUsedWithLegacyAutodiscover);
- }*/
-
// Cannot call legacy Autodiscover service with WindowsLive and other WSSecurity-based credentials
if ((this.getCredentials() != null) && (this.getCredentials() instanceof WSSecurityBasedCredentials)) {
throw new AutodiscoverLocalException(Strings.WLIDCredentialsCannotBeUsedWithLegacyAutodiscover);
@@ -947,8 +840,7 @@ protected GetUserSettingsResponse internalGetLegacyUserSettings(
* @param requestedSettings The requested settings.
* @return GetUserSettingsResponse
*/
- protected GetUserSettingsResponse internalGetSoapUserSettings(
- String smtpAddress,
+ private GetUserSettingsResponse internalGetSoapUserSettings(String smtpAddress,
List requestedSettings) throws Exception {
List smtpAddresses = new ArrayList();
smtpAddresses.add(smtpAddress);
@@ -1008,8 +900,8 @@ protected GetUserSettingsResponse internalGetSoapUserSettings(
* @return GetUserSettingsResponseCollection Object.
* @throws Exception the exception
*/
- protected GetUserSettingsResponseCollection getUserSettings(
- final List smtpAddresses, List settings)
+ private GetUserSettingsResponseCollection getUserSettings(final List smtpAddresses,
+ List settings)
throws Exception {
EwsUtilities.validateParam(smtpAddresses, "smtpAddresses");
EwsUtilities.validateParam(settings, "settings");
@@ -1229,9 +1121,8 @@ private GetUserSettingsResponseCollection internalGetUserSettings(
* @return GetDomainSettingsResponse collection.
* @throws Exception the exception
*/
- protected GetDomainSettingsResponseCollection getDomainSettings(
- final List domains, List settings,
- ExchangeVersion requestedVersion)
+ private GetDomainSettingsResponseCollection getDomainSettings(final List domains,
+ List settings, ExchangeVersion requestedVersion)
throws Exception {
EwsUtilities.validateParam(domains, "domains");
EwsUtilities.validateParam(settings, "settings");
@@ -1332,10 +1223,7 @@ private boolean tryGetAutodiscoverEndpointUrl(String host,
// available.
if ((!endpoints.contains(AutodiscoverEndpoints.Soap)) &&
(!endpoints.contains(
- AutodiscoverEndpoints.WsSecurity))
- // (endpoints .contains( AutodiscoverEndpoints.WSSecuritySymmetricKey) ) &&
- //(endpoints .contains( AutodiscoverEndpoints.WSSecurityX509Cert))
- ) {
+ AutodiscoverEndpoints.WsSecurity))) {
this
.traceMessage(
TraceFlags.AutodiscoverConfiguration,
@@ -1348,62 +1236,7 @@ private boolean tryGetAutodiscoverEndpointUrl(String host,
return false;
}
- // If we have WLID credentials, make sure that we have a WS-Security
- // endpoint
- /*
- if (this.getCredentials() instanceof WindowsLiveCredentials) {
- if (endpoints.contains(AutodiscoverEndpoints.WsSecurity)) {
- this
- .traceMessage(
- TraceFlags.AutodiscoverConfiguration,
- String
- .format(
- "No Autodiscover " +
- "WS-Security " +
- "endpoint is available" +
- " for host %s",
- host));
-
- return false;
- } else {
- url.setParam(new URI(String.format(
- AutodiscoverSoapWsSecurityHttpsUrl, host)));
- }
- }
- else if (this.getCredentials() instanceof PartnerTokenCredentials)
- {
- if (endpoints.contains( AutodiscoverEndpoints.WSSecuritySymmetricKey))
- {
- this.traceMessage(
- TraceFlags.AutodiscoverConfiguration,
- String.format("No Autodiscover WS-Security/SymmetricKey endpoint is available for host {0}", host));
-
- return false;
- }
- else
- {
- url.setParam( new URI(String.format(AutodiscoverSoapWsSecuritySymmetricKeyHttpsUrl, host)));
- }
- }
- else if (this.getCredentials()instanceof X509CertificateCredentials)
- {
- if ((endpoints.contains(AutodiscoverEndpoints.WSSecurityX509Cert))
- {
- this.traceMessage(
- TraceFlags.AutodiscoverConfiguration,
- String.format("No Autodiscover WS-Security/X509Cert endpoint is available for host {0}", host));
-
- return false;
- }
- else
- {
- url.setParam( new URI(String.format(AutodiscoverSoapWsSecurityX509CertHttpsUrl, host)));
- }
- }
- */
return true;
-
-
} else {
this
.traceMessage(
@@ -1426,8 +1259,8 @@ else if (this.getCredentials()instanceof X509CertificateCredentials)
* @return List of Autodiscover URLs.
* @throws java.net.URISyntaxException the URI Syntax exception
*/
- protected List getAutodiscoverServiceUrls(String domainName,
- OutParam scpHostCount) throws URISyntaxException {
+ private List getAutodiscoverServiceUrls(String domainName, OutParam scpHostCount)
+ throws URISyntaxException {
List urls;
urls = new ArrayList();
@@ -1452,8 +1285,7 @@ protected List getAutodiscoverServiceUrls(String domainName,
* @throws java.net.URISyntaxException the uRI syntax exception
* @throws ClassNotFoundException the class not found exception
*/
- protected List getAutodiscoverServiceHosts(String domainName,
- OutParam outParam) throws URISyntaxException,
+ private List getAutodiscoverServiceHosts(String domainName, OutParam outParam) throws URISyntaxException,
ClassNotFoundException {
List urls = this.getAutodiscoverServiceUrls(domainName, outParam);
@@ -1566,22 +1398,6 @@ private EnumSet getEndpointsFromHttpWebResponse(
AutodiscoverWsSecurityEnabledHeaderName).isEmpty())) {
endpoints.add(AutodiscoverEndpoints.WsSecurity);
}
-
- /* if (! (request.getResponseHeaders().get(
- AutodiscoverWsSecuritySymmetricKeyEnabledHeaderName) !=null || request
- .getResponseHeaders().get(
- AutodiscoverWsSecuritySymmetricKeyEnabledHeaderName).isEmpty()))
- {
- endpoints .add( AutodiscoverEndpoints.WSSecuritySymmetricKey);
- }
- if (!(request.getResponseHeaders().get(
- AutodiscoverWsSecurityX509CertEnabledHeaderName)!=null ||
- request.getResponseHeaders().get(
- AutodiscoverWsSecurityX509CertEnabledHeaderName).isEmpty()))
-
- {
- endpoints .add(AutodiscoverEndpoints.WSSecurityX509Cert);
- }*/
return endpoints;
}
@@ -1595,8 +1411,7 @@ private EnumSet getEndpointsFromHttpWebResponse(
* @throws java.io.IOException Signals that an I/O exception has occurred.
* @throws microsoft.exchange.webservices.data.EWSHttpException the eWS http exception
*/
- protected void traceResponse(HttpWebRequest request,
- ByteArrayOutputStream memoryStream) throws XMLStreamException,
+ void traceResponse(HttpWebRequest request, ByteArrayOutputStream memoryStream) throws XMLStreamException,
IOException, EWSHttpException {
this.processHttpResponseHeaders(
TraceFlags.AutodiscoverResponseHttpHeaders, request);
@@ -1624,11 +1439,9 @@ protected void traceResponse(HttpWebRequest request,
* @throws ServiceLocalException the service local exception
* @throws java.net.URISyntaxException the uRI syntax exception
*/
- protected HttpWebRequest prepareHttpWebRequestForUrl(URI url)
+ HttpWebRequest prepareHttpWebRequestForUrl(URI url)
throws ServiceLocalException, URISyntaxException {
- return this.prepareHttpWebRequestForUrl(url, false,
- // acceptGzipEncoding
- false); // allowAutoRedirect
+ return this.prepareHttpWebRequestForUrl(url, false,false);
}
/**
@@ -1751,7 +1564,7 @@ public AutodiscoverService(URI url,
* service.
* @throws microsoft.exchange.webservices.data.ArgumentException
*/
- protected AutodiscoverService(URI url, String domain)
+ private AutodiscoverService(URI url, String domain)
throws ArgumentException {
super();
EwsUtilities.validateDomainNameAllowNull(domain, "domain");
@@ -1769,8 +1582,7 @@ protected AutodiscoverService(URI url, String domain)
* @param requestedServerVersion The requested server version.
* @throws microsoft.exchange.webservices.data.ArgumentException
*/
- protected AutodiscoverService(URI url, String domain,
- ExchangeVersion requestedServerVersion) throws ArgumentException {
+ private AutodiscoverService(URI url, String domain, ExchangeVersion requestedServerVersion) throws ArgumentException {
super(requestedServerVersion);
EwsUtilities.validateDomainNameAllowNull(domain, "domain");
@@ -1785,8 +1597,7 @@ protected AutodiscoverService(URI url, String domain,
* @param service The other service.
* @param requestedServerVersion The requested server version.
*/
- protected AutodiscoverService(ExchangeServiceBase service,
- ExchangeVersion requestedServerVersion) {
+ AutodiscoverService(ExchangeServiceBase service, ExchangeVersion requestedServerVersion) {
super(service, requestedServerVersion);
this.dnsClient = new AutodiscoverDnsClient(this);
}
@@ -1812,8 +1623,7 @@ protected AutodiscoverService(ExchangeServiceBase service) {
* This method handles will run the entire Autodiscover "discovery"
* algorithm and will follow address and URL redirections.
*/
- public GetUserSettingsResponse getUserSettings(String userSmtpAddress,
- UserSettingName... userSettingNames) throws Exception {
+ GetUserSettingsResponse getUserSettings(String userSmtpAddress, UserSettingName... userSettingNames) throws Exception {
List requestedSettings = new ArrayList();
requestedSettings.addAll(Arrays.asList(userSettingNames));
@@ -1907,96 +1717,6 @@ public GetDomainSettingsResponseCollection getDomainSettings(
return this.getDomainSettings(domainslst, settings, requestedVersion);
}
- /**
- * Try to get the partner access information for the given target tenant.
- *
- * @param targetTenantDomain The target domain or user email address.
- * @param partnerAccessCredentials The partner access credentials.
- * @param targetTenantAutodiscoverUrl The autodiscover url for the given tenant.
- * @return True if the partner access information was retrieved, false otherwise.
- */
-
- /** commented as the code belongs to Partener Token credentials. */
-
- /* public boolean tryGetPartnerAccess(
- String targetTenantDomain,
- OutParam partnerAccessCredentials,
- OutParam targetTenantAutodiscoverUrl)
- {
- EwsUtilities.validateNonBlankStringParam(targetTenantDomain, "targetTenantDomain");
-
- // the user should set the url to its own tenant's autodiscover url.
- //
- if (this.url == null)
- {
- throw new ServiceValidationException(Strings.PartnerTokenRequestRequiresUrl);
- }
-
- if (this.getRequestedServerVersion().ordinal() < ExchangeVersion.Exchange2010_SP1.ordinal())
- {
- throw new ServiceVersionException(
- String.format(
- Strings.PartnerTokenIncompatibleWithRequestVersion,
- ExchangeVersion.Exchange2010_SP1));
- }
-
- partnerAccessCredentials = null;
- targetTenantAutodiscoverUrl = null;
-
- String smtpAddress = targetTenantDomain;
- if (!smtpAddress.contains("@"))
- {
- smtpAddress = "SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}@" + targetTenantDomain;
- }
-
- List smtpAddresses = new ArrayList();
- smtpAddresses.add(smtpAddress);
- List settings = new ArrayList();
- settings.add(UserSettingName.ExternalEwsUrl);
-
- GetUserSettingsRequest request = new GetUserSettingsRequest(this, this.url, true expectPartnerToken );
- request.setSmtpAddresses(smtpAddresses);
- request.setSettings(settings);
- GetUserSettingsResponseCollection response = request.execute();
-
- if (request.getPartnerToken()!=null && !request.getPartnerToken().isEmpty())
- || request.getPartnerTokenReference()!=null && !request.getPartnerTokenReference().isEmpty() ))
- {
- return false;
- }
-
- if (request.getErrorCode() == AutodiscoverErrorCode.NoError)
- {
- GetUserSettingsResponse firstResponse = request.getResponse(0);
- if (firstResponse.getErrorCode() == AutodiscoverErrorCode.NoError)
- {
- targetTenantAutodiscoverUrl = this.url;
- }
- else if (firstResponse.getErrorCode() == AutodiscoverErrorCode.RedirectUrl)
- {
- targetTenantAutodiscoverUrl = new URI(firstResponse.getRedirectTarget());
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
-
- partnerAccessCredentials = new PartnerTokenCredentials(
- request.getPartnerToken(),
- request.getPartnerTokenReference());
-
- targetTenantAutodiscoverUrl = partnerAccessCredentials.adjustUrl(
- targetTenantAutodiscoverUrl);
-
- return true;
- }
-*/
-
/**
* Gets the domain this service is bound to. When this property is
* set, the domain
@@ -2050,7 +1770,7 @@ public void setUrl(URI value) {
this.url = value;
}
- public Boolean isExternal() {
+ protected Boolean isExternal() {
return this.isExternal;
}
From e52ab9a38aa3b705df5a1c8d311f544eabaf545d Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Sun, 12 Nov 2017 19:43:26 +0100
Subject: [PATCH 22/37] Remove SCP lookup as it is not even implemented.
---
.../webservices/data/AutodiscoverService.java | 146 +-----------------
.../webservices/data/ExchangeService.java | 38 ++---
2 files changed, 19 insertions(+), 165 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index 0acae5286..30f6281f1 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -51,11 +51,6 @@ public final class AutodiscoverService extends ExchangeServiceBase implements
*/
private String domain;
- /**
- * The is external.
- */
- private Boolean isExternal = true;
-
/**
* The url.
*/
@@ -77,11 +72,6 @@ public final class AutodiscoverService extends ExchangeServiceBase implements
*/
private String dnsServerAddress;
- /**
- * The enable scp lookup.
- */
- private boolean enableScpLookup = true;
-
/**
* Autodiscover legacy path
*/
@@ -454,20 +444,12 @@ TSettings internalGetLegacyUserSettings(
throws Exception {
String domainName = EwsUtilities.domainFromEmailAddress(emailAddress);
- int scpUrlCount;
- OutParam outParamInt = new OutParam();
- List urls = this.getAutodiscoverServiceUrls(domainName, outParamInt);
- scpUrlCount = outParamInt.getParam();
+ List urls = this.getAutodiscoverServiceUrls(domainName);
if (urls.size() == 0) {
throw new ServiceValidationException(
Strings.AutodiscoverServiceRequestRequiresDomainOrUrl);
}
- // Assume caller is not inside the Intranet, regardless of whether SCP
- // Urls were returned or not. SCP Urls are only relevent if one of them
- // returns valid Autodiscover settings.
- this.isExternal = true;
-
int currentUrlIndex = 0;
// Used to save exception for later reporting.
@@ -476,7 +458,6 @@ TSettings internalGetLegacyUserSettings(
do {
URI autodiscoverUrl = urls.get(currentUrlIndex);
- boolean isScpUrl = currentUrlIndex < scpUrlCount;
try {
settings = this.getLegacyUserSettingsAtUrl(cls,
@@ -484,11 +465,6 @@ TSettings internalGetLegacyUserSettings(
switch (settings.getResponseType()) {
case Success:
- // Not external if Autodiscover endpoint found via SCP
- // returned the settings.
- if (isScpUrl) {
- this.isExternal = false;
- }
this.url = autodiscoverUrl;
return settings;
case RedirectUrl:
@@ -531,12 +507,6 @@ TSettings internalGetLegacyUserSettings(
"address '%s'.",
settings
.getRedirectTarget()));
- // Bug E14:255576 If this email address was already tried, we may have a loop
- // in SCP lookups. Disable consideration of SCP records.
- this.disableScpLookupIfDuplicateRedirection(
- settings.getRedirectTarget(),
- redirectionEmailAddresses);
-
return this.internalGetLegacyUserSettings(cls,
settings.getRedirectTarget(),
redirectionEmailAddresses,
@@ -546,26 +516,7 @@ TSettings internalGetLegacyUserSettings(
Strings.MaximumRedirectionHopsExceeded);
}
case Error:
- // Don't treat errors from an SCP-based Autodiscover service
- // to be conclusive.
- // We'll try the next one and record the error for later.
- if (isScpUrl) {
- this
- .traceMessage(
- TraceFlags.AutodiscoverConfiguration,
- "Error returned by " +
- "Autodiscover service " +
- "found via SCP, treating " +
- "as inconclusive.");
-
- delayedException = new AutodiscoverRemoteException(
- Strings.AutodiscoverError, settings.getError());
- currentUrlIndex++;
- } else {
- throw new AutodiscoverRemoteException(
- Strings.AutodiscoverError, settings.getError());
- }
- break;
+ throw new AutodiscoverRemoteException(Strings.AutodiscoverError, settings.getError());
default:
EwsUtilities
.EwsAssert(false,
@@ -713,11 +664,6 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
Strings.AutodiscoverError, settings.getParam()
.getError());
case RedirectAddress:
- // If this email address was already tried,
- //we may have a loop
- // in SCP lookups. Disable consideration of SCP records.
- this.disableScpLookupIfDuplicateRedirection(settings.getParam().getRedirectTarget(),
- redirectionEmailAddresses);
OutParam outParam = new OutParam();
outParam.setParam(currentHop);
settings.setParam(
@@ -790,25 +736,6 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
return false;
}
- /**
- * Disables SCP lookup if duplicate email address redirection.
- *
- * @param emailAddress The email address to use.
- * @param redirectionEmailAddresses The list of prior redirection email addresses.
- */
- private void disableScpLookupIfDuplicateRedirection(
- String emailAddress,
- List redirectionEmailAddresses) {
- // SMTP addresses are case-insensitive so entries are converted to lower-case.
- emailAddress = emailAddress.toLowerCase();
-
- if (redirectionEmailAddresses.contains(emailAddress)) {
- this.enableScpLookup = false;
- } else {
- redirectionEmailAddresses.add(emailAddress);
- }
- }
-
/**
* Gets user settings from Autodiscover legacy endpoint.
*
@@ -864,12 +791,6 @@ private GetUserSettingsResponse internalGetSoapUserSettings(String smtpAddress,
toLowerCase());
this.url = null;
this.domain = null;
-
- // If this email address was already tried,
- //we may have a loop
- // in SCP lookups. Disable consideration of SCP records.
- this.disableScpLookupIfDuplicateRedirection(response.getRedirectTarget(),
- redirectionEmailAddresses);
break;
case RedirectUrl:
@@ -974,21 +895,10 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
// No Url or Domain specified, need to figure out which endpoint(s) to
// try.
else {
- // Assume caller is not inside the Intranet, regardless of whether
- // SCP Urls
- // were returned or not. SCP Urls are only relevent if one of them
- // returns
- // valid Autodiscover settings.
- this.isExternal = true;
-
URI autodiscoverUrl;
String domainName = getDomainMethod.func();
- int scpHostCount;
- OutParam outParam = new OutParam();
- List hosts = this.getAutodiscoverServiceHosts(domainName,
- outParam);
- scpHostCount = outParam.getParam();
+ List hosts = this.getAutodiscoverServiceHosts(domainName);
if (hosts.size() == 0) {
throw new ServiceValidationException(
Strings.AutodiscoverServiceRequestRequiresDomainOrUrl);
@@ -996,7 +906,6 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
for (int currentHostIndex = 0; currentHostIndex < hosts.size(); currentHostIndex++) {
String host = hosts.get(currentHostIndex);
- boolean isScpHost = currentHostIndex < scpHostCount;
OutParam outParams = new OutParam();
if (this.tryGetAutodiscoverEndpointUrl(host, outParams)) {
autodiscoverUrl = outParams.getParam();
@@ -1007,12 +916,6 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
// If we got this far, the response was successful, set Url.
this.url = autodiscoverUrl;
- // Not external if Autodiscover endpoint found via SCP
- // returned the settings.
- if (isScpHost) {
- this.isExternal = false;
- }
-
return response;
}
}
@@ -1255,17 +1158,12 @@ private boolean tryGetAutodiscoverEndpointUrl(String host,
* Gets the list of autodiscover service URLs.
*
* @param domainName Domain name.
- * @param scpHostCount Count of hosts found via SCP lookup.
* @return List of Autodiscover URLs.
* @throws java.net.URISyntaxException the URI Syntax exception
*/
- private List getAutodiscoverServiceUrls(String domainName, OutParam scpHostCount)
+ private List getAutodiscoverServiceUrls(String domainName)
throws URISyntaxException {
- List urls;
-
- urls = new ArrayList();
-
- scpHostCount.setParam(urls.size());
+ List urls = new ArrayList();
// As a fallback, add autodiscover URLs base on the domain name.
urls.add(new URI(String.format(AutodiscoverLegacyHttpsUrl,
@@ -1280,15 +1178,14 @@ private List getAutodiscoverServiceUrls(String domainName, OutParam getAutodiscoverServiceHosts(String domainName, OutParam outParam) throws URISyntaxException,
+ private List getAutodiscoverServiceHosts(String domainName) throws URISyntaxException,
ClassNotFoundException {
- List urls = this.getAutodiscoverServiceUrls(domainName, outParam);
+ List urls = this.getAutodiscoverServiceUrls(domainName);
List lst = new ArrayList();
for (URI url : urls) {
lst.add(url.getHost());
@@ -1770,15 +1667,6 @@ public void setUrl(URI value) {
this.url = value;
}
- protected Boolean isExternal() {
- return this.isExternal;
- }
-
- protected void setIsExternal(Boolean value) {
- this.isExternal = value;
- }
-
-
/**
* Gets the redirection url validation callback.
*
@@ -1817,26 +1705,6 @@ protected void setDnsServerAddress(String value) {
this.dnsServerAddress = value;
}
- /**
- * Gets a value indicating whether the AutodiscoverService should
- * perform SCP (ServiceConnectionPoint) record lookup when determining
- * the Autodiscover service URL.
- *
- * @return the enable scp lookup
- */
- public boolean getEnableScpLookup() {
- return this.enableScpLookup;
- }
-
- /**
- * Sets the enable scp lookup.
- *
- * @param value the new enable scp lookup
- */
- public void setEnableScpLookup(boolean value) {
- this.enableScpLookup = value;
- }
-
/*
* (non-Javadoc)
*
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java
index 79e0a193b..537baeaca 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java
@@ -28,7 +28,15 @@
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
/**
* Represents a binding to the Exchange Web Services.
@@ -66,8 +74,6 @@ public final class ExchangeService extends ExchangeServiceBase implements
*/
private UnifiedMessaging unifiedMessaging;
- private boolean enableScpLookup = true;
-
/**
* When false, used to indicate that we should use "Exchange2007" as the server version String rather than
* Exchange2007_SP1 (@see #getExchange2007CompatibilityMode).
@@ -3543,7 +3549,6 @@ private URI getAutodiscoverUrl(String emailAddress,
requestedServerVersion);
autodiscoverService
.setRedirectionUrlValidationCallback(validateRedirectionUrlCallback);
- autodiscoverService.setEnableScpLookup(this.getEnableScpLookup());
GetUserSettingsResponse response = autodiscoverService.getUserSettings(
emailAddress, UserSettingName.InternalEwsUrl,
@@ -3551,8 +3556,7 @@ private URI getAutodiscoverUrl(String emailAddress,
switch (response.getErrorCode()) {
case NoError:
- return this.getEwsUrlFromResponse(response, autodiscoverService
- .isExternal().TRUE);
+ return this.getEwsUrlFromResponse(response);
case InvalidUser:
throw new ServiceRemoteException(String.format(Strings.InvalidUser,
@@ -3573,8 +3577,7 @@ private URI getAutodiscoverUrl(String emailAddress,
}
}
- private URI getEwsUrlFromResponse(GetUserSettingsResponse response,
- boolean isExternal) throws URISyntaxException,
+ private URI getEwsUrlFromResponse(GetUserSettingsResponse response) throws URISyntaxException,
AutodiscoverLocalException {
String uriString;
@@ -3584,8 +3587,7 @@ private URI getEwsUrlFromResponse(GetUserSettingsResponse response,
// Bug E14:82650 -- Either protocol
// may be returned without a configured URL.
OutParam outParam = new OutParam();
- if ((isExternal && response.tryGetSettingValue(String.class,
- UserSettingName.ExternalEwsUrl, outParam))) {
+ if (response.tryGetSettingValue(String.class, UserSettingName.ExternalEwsUrl, outParam)) {
uriString = outParam.getParam();
if (!(uriString == null || uriString.isEmpty())) {
return new URI(uriString);
@@ -3816,22 +3818,6 @@ public UnifiedMessaging getUnifiedMessaging() {
return this.unifiedMessaging;
}
- /**
- * Gets or sets a value indicating whether the AutodiscoverUrl method should
- * perform SCP (Service Connection Point) record lookup when determining the
- * Autodiscover service URL.
- *
- * @return enable scp lookup flag.
- */
- public boolean getEnableScpLookup() {
- return this.enableScpLookup;
- }
-
-
- public void setEnableScpLookup(boolean value) {
- this.enableScpLookup = value;
- }
-
/**
* Returns true whether Exchange2007 compatibility mode is enabled, false otherwise.
*/
From 4510b9dfe166280d881b30419728745931186acd Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Sun, 12 Nov 2017 19:46:04 +0100
Subject: [PATCH 23/37] Remove redirectionEmailAddresses lists as they are only
used during SCP lookups.
---
.../webservices/data/AutodiscoverService.java | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index 30f6281f1..602b50498 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -416,11 +416,9 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
int currentHop = 1;
OutParam outParam = new OutParam();
outParam.setParam(currentHop);
- List redirectionEmailAddresses = new ArrayList();
return this.internalGetLegacyUserSettings(
cls,
emailAddress,
- redirectionEmailAddresses,
outParam);
}
}
@@ -439,7 +437,6 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
TSettings internalGetLegacyUserSettings(
Class cls,
String emailAddress,
- List redirectionEmailAddresses,
OutParam currentHop)
throws Exception {
String domainName = EwsUtilities.domainFromEmailAddress(emailAddress);
@@ -509,7 +506,6 @@ TSettings internalGetLegacyUserSettings(
.getRedirectTarget()));
return this.internalGetLegacyUserSettings(cls,
settings.getRedirectTarget(),
- redirectionEmailAddresses,
currentHop);
} else {
throw new AutodiscoverLocalException(
@@ -642,8 +638,6 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
Class cls, String emailAddress, URI redirectionUrl,
OutParam settings) throws AutodiscoverLocalException,
AutodiscoverRemoteException, Exception {
- List redirectionEmailAddresses = new ArrayList();
-
// Bug 60274: Performing a non-SSL HTTP GET to retrieve a redirection
// URL is potentially unsafe. We allow the caller
// to specify delegate to be called to determine whether we are allowed
@@ -669,7 +663,6 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
settings.setParam(
this.internalGetLegacyUserSettings(cls,
emailAddress,
- redirectionEmailAddresses,
outParam));
return true;
case RedirectUrl:
@@ -772,9 +765,6 @@ private GetUserSettingsResponse internalGetSoapUserSettings(String smtpAddress,
List smtpAddresses = new ArrayList();
smtpAddresses.add(smtpAddress);
- List redirectionEmailAddresses = new ArrayList();
- redirectionEmailAddresses.add(smtpAddress.toLowerCase());
-
for (int currentHop = 0; currentHop < AutodiscoverService.AutodiscoverMaxRedirections; currentHop++) {
GetUserSettingsResponse response = this.getUserSettings(smtpAddresses,
requestedSettings).getTResponseAtIndex(0);
@@ -799,7 +789,6 @@ private GetUserSettingsResponse internalGetSoapUserSettings(String smtpAddress,
String.format("Autodiscover service returned redirection URL '%s'.",
response.getRedirectTarget()));
- //this.url = new URI(response.getRedirectTarget());
this.url = this.getCredentials().adjustUrl(new URI(response.getRedirectTarget()));
break;
From ad470eb9c424c91175048355dd6de515d0193638 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Sun, 12 Nov 2017 19:58:06 +0100
Subject: [PATCH 24/37] Further cleanup AutodiscoverService.
---
.../webservices/data/AutodiscoverService.java | 79 +++++--------------
1 file changed, 18 insertions(+), 61 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index 602b50498..a1f7bec33 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -350,12 +350,11 @@ private URI getRedirectUrl(String domainName)
private boolean tryGetRedirectionResponse(HttpWebRequest request,
OutParam redirectUrl) throws XMLStreamException, IOException,
EWSHttpException {
- // redirectUrl = null;
if (AutodiscoverRequest.isRedirectionResponse(request)) {
// Get the redirect location and verify that it's valid.
String location = request.getResponseHeaderField("Location");
- if (!(location == null || location.isEmpty())) {
+ if (location != null && !location.isEmpty()) {
try {
redirectUrl.setParam(new URI(location));
@@ -406,20 +405,16 @@ TSettings getLegacyUserSettings(Class cls, String emailAddress) throw
}
// If Domain is specified, figure out the endpoint Url and call service.
- else if (!(this.domain == null || this.domain.isEmpty())) {
+ else if (this.domain != null && !this.domain.isEmpty()) {
URI autodiscoverUrl = new URI(String.format(AutodiscoverLegacyHttpsUrl, this.domain));
return this.getLegacyUserSettingsAtUrl(cls,
emailAddress, autodiscoverUrl);
} else {
- // No Url or Domain specified, need to
- //figure out which endpoint to use.
+ // No Url or Domain specified, need to figure out which endpoint to use.
int currentHop = 1;
OutParam outParam = new OutParam();
outParam.setParam(currentHop);
- return this.internalGetLegacyUserSettings(
- cls,
- emailAddress,
- outParam);
+ return this.internalGetLegacyUserSettings(cls, emailAddress, outParam);
}
}
@@ -449,8 +444,6 @@ TSettings internalGetLegacyUserSettings(
int currentUrlIndex = 0;
- // Used to save exception for later reporting.
- Exception delayedException = null;
TSettings settings;
do {
@@ -472,11 +465,7 @@ TSettings internalGetLegacyUserSettings(
.traceMessage(
TraceFlags.AutodiscoverResponse,
String
- .format(
- "Autodiscover " +
- "service " +
- "returned " +
- "redirection URL '%s'.",
+ .format("Autodiscover service returned redirection URL '%s'.",
settings
.getRedirectTarget()));
@@ -494,14 +483,8 @@ TSettings internalGetLegacyUserSettings(
this
.traceMessage(
- TraceFlags.AutodiscoverResponse,
- String
- .format(
- "Autodiscover " +
- "service " +
- "returned " +
- "redirection email " +
- "address '%s'.",
+ TraceFlags.AutodiscoverResponse, String.format(
+ "Autodiscover service returned redirection email address '%s'.",
settings
.getRedirectTarget()));
return this.internalGetLegacyUserSettings(cls,
@@ -573,11 +556,6 @@ TSettings internalGetLegacyUserSettings(
return outParam.getParam();
}
- // If there was an earlier exception, throw it.
- if (delayedException != null) {
- throw delayedException;
- }
-
throw new AutodiscoverLocalException(Strings.AutodiscoverCouldNotBeLocated);
}
}
@@ -603,7 +581,7 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
String hostname = this.dnsClient
.findAutodiscoverHostFromSrv(domainName);
- if (!(hostname == null || hostname.isEmpty())) {
+ if (hostname != null && !hostname.isEmpty()) {
this
.traceMessage(TraceFlags.AutodiscoverConfiguration,
String.format(
@@ -670,20 +648,10 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
redirectionUrl = new URI(settings.getParam()
.getRedirectTarget());
} catch (URISyntaxException ex) {
- this
- .traceMessage(
- TraceFlags.
- AutodiscoverConfiguration,
- String
- .format(
- "Service " +
- "returned " +
- "invalid " +
- "redirection " +
- "URL %s",
- settings
- .getParam()
- .getRedirectTarget()));
+ this.traceMessage(TraceFlags.
+ AutodiscoverConfiguration, String
+ .format("Service returned invalid redirection URL %s",
+ settings.getParam().getRedirectTarget()));
return false;
}
break;
@@ -739,7 +707,7 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
private GetUserSettingsResponse internalGetLegacyUserSettings(String emailAddress,
List requestedSettings) throws Exception {
// Cannot call legacy Autodiscover service with WindowsLive and other WSSecurity-based credentials
- if ((this.getCredentials() != null) && (this.getCredentials() instanceof WSSecurityBasedCredentials)) {
+ if (this.getCredentials() instanceof WSSecurityBasedCredentials) {
throw new AutodiscoverLocalException(Strings.WLIDCredentialsCannotBeUsedWithLegacyAutodiscover);
}
@@ -747,8 +715,6 @@ private GetUserSettingsResponse internalGetLegacyUserSettings(String emailAddres
OutlookConfigurationSettings.class,
emailAddress);
-
-
return settings.convertSettings(emailAddress, requestedSettings);
}
@@ -816,8 +782,7 @@ private GetUserSettingsResponseCollection getUserSettings(final List smt
EwsUtilities.validateParam(smtpAddresses, "smtpAddresses");
EwsUtilities.validateParam(settings, "settings");
- return this.getSettings(
- GetUserSettingsResponseCollection.class, UserSettingName.class,
+ return this.getSettings(
smtpAddresses, settings, null, this,
new IFuncDelegate() {
public String func() throws FormatException {
@@ -832,8 +797,6 @@ public String func() throws FormatException {
*
* @param the generic type
* @param the generic type
- * @param cls the cls
- * @param cls1 the cls1
* @param identities Either the domains or the SMTP addresses of the users.
* @param settings The settings.
* @param requestedVersion Requested version of the Exchange service.
@@ -844,8 +807,6 @@ public String func() throws FormatException {
*/
private
TGetSettingsResponseCollection getSettings(
- Class cls,
- Class cls1,
List identities,
List settings,
ExchangeVersion requestedVersion,
@@ -893,14 +854,11 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
Strings.AutodiscoverServiceRequestRequiresDomainOrUrl);
}
- for (int currentHostIndex = 0; currentHostIndex < hosts.size(); currentHostIndex++) {
- String host = hosts.get(currentHostIndex);
+ for (String host : hosts) {
OutParam outParams = new OutParam();
if (this.tryGetAutodiscoverEndpointUrl(host, outParams)) {
autodiscoverUrl = outParams.getParam();
- response = getSettingsMethod.func(identities, settings,
- requestedVersion,
- autodiscoverUrl);
+ response = getSettingsMethod.func(identities, settings, requestedVersion, autodiscoverUrl);
// If we got this far, the response was successful, set Url.
this.url = autodiscoverUrl;
@@ -1019,9 +977,8 @@ private GetDomainSettingsResponseCollection getDomainSettings(final List
EwsUtilities.validateParam(domains, "domains");
EwsUtilities.validateParam(settings, "settings");
- return this.getSettings(
- GetDomainSettingsResponseCollection.class,
- DomainSettingName.class, domains, settings,
+ return this.getSettings(
+ domains, settings,
requestedVersion, this,
new IFuncDelegate() {
public String func() {
From be6c4e32f0e43d231fcecebe30aaba91ccd40533 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Mon, 13 Nov 2017 21:11:16 +0100
Subject: [PATCH 25/37] Fix HTTP GET in HttpClientWebRequest
---
.../data/HttpClientWebRequest.java | 56 +++++++++++--------
1 file changed, 32 insertions(+), 24 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java b/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java
index 4d2dce876..073d49659 100644
--- a/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java
+++ b/src/main/java/microsoft/exchange/webservices/data/HttpClientWebRequest.java
@@ -25,7 +25,6 @@
import org.apache.http.Header;
import org.apache.http.HttpHost;
-import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthProtocolState;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.NTCredentials;
@@ -33,13 +32,19 @@
import org.apache.http.client.config.AuthSchemes;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.config.SocketConfig;
-import org.apache.http.impl.client.*;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -54,7 +59,7 @@ class HttpClientWebRequest extends HttpWebRequest {
/**
* The Http Method.
*/
- private HttpPost httpPost = null;
+ private HttpRequestBase httpRequest = null;
private CloseableHttpResponse response = null;
private final CloseableHttpClient httpClient;
@@ -79,15 +84,15 @@ public void close() throws IOException {
// If that is not possible, we simply cleanup the whole connection
if (response != null && response.getEntity() != null) {
EntityUtils.consume(response.getEntity());
- } else if (httpPost != null) {
- httpPost.releaseConnection();
+ } else if (httpRequest != null) {
+ httpRequest.releaseConnection();
}
- // We set httpPost to null to prevent the connection from being closed again by an accidental
+ // We set httpRequest to null to prevent the connection from being closed again by an accidental
// second call to close()
// The response is kept, in case something in the library still wants to read something from it,
// like response code or headers
- httpPost = null;
+ httpRequest = null;
}
/**
@@ -95,22 +100,26 @@ public void close() throws IOException {
*/
@Override
public void prepareConnection() {
- httpPost = new HttpPost(getUrl().toString());
+ if (getRequestMethod().equals("POST")) {
+ httpRequest = new HttpPost(getUrl().toString());
+ } else {
+ httpRequest = new HttpGet(getUrl().toString());
+ }
// Populate headers.
- httpPost.addHeader("Content-type", getContentType());
- httpPost.addHeader("User-Agent", getUserAgent());
- httpPost.addHeader("Accept", getAccept());
- httpPost.addHeader("Keep-Alive", "300");
- httpPost.addHeader("Connection", "Keep-Alive");
+ httpRequest.addHeader("Content-type", getContentType());
+ httpRequest.addHeader("User-Agent", getUserAgent());
+ httpRequest.addHeader("Accept", getAccept());
+ httpRequest.addHeader("Keep-Alive", "300");
+ httpRequest.addHeader("Connection", "Keep-Alive");
if (isAcceptGzipEncoding()) {
- httpPost.addHeader("Accept-Encoding", "gzip,deflate");
+ httpRequest.addHeader("Accept-Encoding", "gzip,deflate");
}
if (getHeaders() != null) {
for (Map.Entry httpHeader : getHeaders().entrySet()) {
- httpPost.addHeader(httpHeader.getKey(), httpHeader.getValue());
+ httpRequest.addHeader(httpHeader.getKey(), httpHeader.getValue());
}
}
@@ -157,7 +166,7 @@ public void prepareConnection() {
httpContext.getTargetAuthState().reset();
}
- httpPost.setConfig(requestConfigBuilder.build());
+ httpRequest.setConfig(requestConfigBuilder.build());
}
/**
@@ -205,11 +214,10 @@ public InputStream getErrorStream() throws EWSHttpException {
*/
@Override
public OutputStream getOutputStream() throws EWSHttpException {
- OutputStream os = null;
throwIfRequestIsNull();
- os = new ByteArrayOutputStream();
+ OutputStream os = new ByteArrayOutputStream();
- httpPost.setEntity(new ByteArrayOSRequestEntity(os));
+ ((HttpPost) httpRequest).setEntity(new ByteArrayOSRequestEntity(os));
return os;
}
@@ -297,7 +305,7 @@ public String getResponseContentType() throws EWSHttpException {
@Override
public int executeRequest() throws EWSHttpException, IOException {
throwIfRequestIsNull();
- response = httpClient.execute(httpPost, httpContext);
+ response = httpClient.execute(httpRequest, httpContext);
return response.getStatusLine().getStatusCode(); // ?? don't know what is wanted in return
}
@@ -330,7 +338,7 @@ public String getResponseText() throws EWSHttpException {
* @throws EWSHttpException the eWS http exception
*/
private void throwIfRequestIsNull() throws EWSHttpException {
- if (null == httpPost) {
+ if (null == httpRequest) {
throw new EWSHttpException("Connection not established");
}
}
@@ -351,7 +359,7 @@ public Map getRequestProperty() throws EWSHttpException {
throwIfRequestIsNull();
Map map = new HashMap();
- Header[] hM = httpPost.getAllHeaders();
+ Header[] hM = httpRequest.getAllHeaders();
for (Header header : hM) {
map.put(header.getName(), header.getValue());
}
From b75bd67379ae9234e3caf0e7fb915e394ce50344 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Mon, 13 Nov 2017 21:19:48 +0100
Subject: [PATCH 26/37] Fix legacy autodiscover RedirectUrl handling.
---
.../exchange/webservices/data/AutodiscoverService.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index a1f7bec33..12de141c2 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -469,7 +469,7 @@ TSettings internalGetLegacyUserSettings(
settings
.getRedirectTarget()));
- urls.add(currentUrlIndex, new URI(
+ urls.set(currentUrlIndex, new URI(
settings.getRedirectTarget()));
break;
From e035620067ade29ca992456150ca6208f81ff736 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Mon, 13 Nov 2017 21:26:21 +0100
Subject: [PATCH 27/37] Version 2.0-eveoh18
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 196495a74..53ec8860a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh17
+ 2.0-eveoh18Exchange Web Services Java APIExchange Web Services (EWS) Java API
From 2127c1ca638c5117e9570eb5728f4c86d9de9eff Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Mon, 13 Nov 2017 21:43:05 +0100
Subject: [PATCH 28/37] Fix autodiscover timeout
---
.../exchange/webservices/data/AutodiscoverService.java | 2 ++
.../exchange/webservices/data/ExchangeServiceBase.java | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index 12de141c2..a225b05bf 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -306,6 +306,7 @@ private URI getRedirectUrl(String domainName)
request.setRequestMethod("GET");
request.setAllowAutoRedirect(false);
+ request.setTimeout(timeout);
// Do NOT allow authentication as this single request will be made over plain HTTP.
request.setAllowAuthentication(false);
@@ -1174,6 +1175,7 @@ private boolean tryGetEnabledEndpointsForHost(String host,
request.setAllowAutoRedirect(false);
request.setPreAuthenticate(false);
request.setUseDefaultCredentials(this.getUseDefaultCredentials());
+ request.setTimeout(timeout);
prepareCredentials(request);
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
index 39d3ce8c4..f1bc2bdd0 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeServiceBase.java
@@ -86,7 +86,7 @@ public abstract class ExchangeServiceBase implements Closeable {
/**
* The timeout.
*/
- private int timeout = 100000;
+ protected int timeout = 100000;
/**
* The trace enabled.
From 113d67b7e2be6e51f7ef7353b9efbc7d6920f3f2 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Mon, 13 Nov 2017 21:43:53 +0100
Subject: [PATCH 29/37] Swap autodiscover.domain.xx and domain.xx URL's, as the
first one is far more common
---
.../exchange/webservices/data/AutodiscoverService.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index a225b05bf..9f270af76 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -1114,9 +1114,9 @@ private List getAutodiscoverServiceUrls(String domainName)
// As a fallback, add autodiscover URLs base on the domain name.
urls.add(new URI(String.format(AutodiscoverLegacyHttpsUrl,
- domainName)));
+ "autodiscover." + domainName)));
urls.add(new URI(String.format(AutodiscoverLegacyHttpsUrl,
- "autodiscover." + domainName)));
+ domainName)));
return urls;
}
From a79d72b4bc6dca40dbad4c4d59d4df7df29d99ad Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Mon, 13 Nov 2017 21:44:46 +0100
Subject: [PATCH 30/37] Version 2.0-eveoh19
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 53ec8860a..2949229e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh18
+ 2.0-eveoh19Exchange Web Services Java APIExchange Web Services (EWS) Java API
From 5021241c88e96dbecf3047cee5e9a9244e15deb6 Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Sun, 11 Mar 2018 15:12:47 +0100
Subject: [PATCH 31/37] Fix redirect by email when using legacy URL's.
Previously, it used the same emailaddress over and over again, leading to a stackoverflow.
---
.idea/codeStyles/Project.xml | 97 +++++++++++++++++++
.idea/codeStyles/codeStyleConfig.xml | 5 +
.../Maven__org_mockito_mockito_all_1_9_5.xml | 13 +++
ews-java-api.iml | 2 +-
pom.xml | 2 +-
.../webservices/data/AutodiscoverService.java | 2 +-
6 files changed, 118 insertions(+), 3 deletions(-)
create mode 100644 .idea/codeStyles/Project.xml
create mode 100644 .idea/codeStyles/codeStyleConfig.xml
create mode 100644 .idea/libraries/Maven__org_mockito_mockito_all_1_9_5.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 000000000..65c3837d9
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 000000000..79ee123c2
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_mockito_mockito_all_1_9_5.xml b/.idea/libraries/Maven__org_mockito_mockito_all_1_9_5.xml
new file mode 100644
index 000000000..7797878d7
--- /dev/null
+++ b/.idea/libraries/Maven__org_mockito_mockito_all_1_9_5.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ews-java-api.iml b/ews-java-api.iml
index e555cc0d3..7b784e779 100644
--- a/ews-java-api.iml
+++ b/ews-java-api.iml
@@ -1,6 +1,6 @@
-
+
diff --git a/pom.xml b/pom.xml
index 2949229e1..d90b83dff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.microsoft.ews-java-apiews-java-api
- 2.0-eveoh19
+ 2.0-eveoh20Exchange Web Services Java APIExchange Web Services (EWS) Java API
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index 9f270af76..6dc88e3aa 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -641,7 +641,7 @@ protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
outParam.setParam(currentHop);
settings.setParam(
this.internalGetLegacyUserSettings(cls,
- emailAddress,
+ settings.getParam().getRedirectTarget(),
outParam));
return true;
case RedirectUrl:
From 1d8c3800cbcf80c25f3037c46cc736043d028c3d Mon Sep 17 00:00:00 2001
From: Mike Noordermeer
Date: Fri, 5 Apr 2019 15:15:36 +0200
Subject: [PATCH 32/37] Remove some unneeded code from the Autodiscover
service.
---
.../webservices/data/AutodiscoverService.java | 439 ++----------------
.../webservices/data/DomainSettingName.java | 45 --
.../webservices/data/ExchangeService.java | 32 +-
.../data/GetDomainSettingsRequest.java | 277 -----------
.../data/GetDomainSettingsResponse.java | 249 ----------
.../GetDomainSettingsResponseCollection.java | 68 ---
.../webservices/data/IFunctionDelegate.java | 58 ---
.../data/GetUserSettingsRequestTest.java | 185 --------
8 files changed, 33 insertions(+), 1320 deletions(-)
delete mode 100644 src/main/java/microsoft/exchange/webservices/data/DomainSettingName.java
delete mode 100644 src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsRequest.java
delete mode 100644 src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponse.java
delete mode 100644 src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponseCollection.java
delete mode 100644 src/main/java/microsoft/exchange/webservices/data/IFunctionDelegate.java
delete mode 100644 src/test/java/microsoft/exchange/webservices/data/GetUserSettingsRequestTest.java
diff --git a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
index 6dc88e3aa..b9c01c4bf 100644
--- a/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/AutodiscoverService.java
@@ -25,7 +25,6 @@
import javax.xml.stream.XMLStreamException;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -36,15 +35,13 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
/**
* Represents a binding to the Exchange Autodiscover Service.
*/
-public final class AutodiscoverService extends ExchangeServiceBase implements
- IAutodiscoverRedirectionUrl, IFunctionDelegate {
+public final class AutodiscoverService extends ExchangeServiceBase {
/**
* The domain.
@@ -127,19 +124,6 @@ public final class AutodiscoverService extends ExchangeServiceBase implements
MinimumRequestVersionForAutoDiscoverSoapService =
ExchangeVersion.Exchange2010;
- /**
- * Default implementation of AutodiscoverRedirectionUrlValidationCallback.
- * Always returns true indicating that the URL can be used.
- *
- * @param redirectionUrl the redirection url
- * @return Returns true.
- * @throws AutodiscoverLocalException the autodiscover local exception
- */
- private boolean defaultAutodiscoverRedirectionUrlValidationCallback(
- String redirectionUrl) throws AutodiscoverLocalException {
- throw new AutodiscoverLocalException(String.format(
- Strings.AutodiscoverRedirectBlocked, redirectionUrl));
- }
// Legacy Autodiscover
@@ -175,29 +159,13 @@ TSettings getLegacyUserSettingsAtUrl(
request);
OutputStream urlOutStream = request.getOutputStream();
- // If tracing is enabled, we generate the request in-memory so that we
- // can pass it along to the ITraceListener. Then we copy the stream to
- // the request stream.
- if (this.isTraceEnabledFor(TraceFlags.AutodiscoverRequest)) {
- ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
-
- PrintWriter writer = new PrintWriter(memoryStream);
- this.writeLegacyAutodiscoverRequest(emailAddress, settings, writer);
- writer.flush();
-
- this.traceXml(TraceFlags.AutodiscoverRequest, memoryStream);
- memoryStream.writeTo(urlOutStream);
- urlOutStream.flush();
- urlOutStream.close();
- memoryStream.close();
- } else {
- PrintWriter writer = new PrintWriter(urlOutStream);
- this.writeLegacyAutodiscoverRequest(emailAddress, settings, writer);
+ PrintWriter writer = new PrintWriter(urlOutStream);
+ this.writeLegacyAutodiscoverRequest(emailAddress, settings, writer);
+
+ writer.flush();
+ urlOutStream.flush();
+ urlOutStream.close();
- writer.flush();
- urlOutStream.flush();
- urlOutStream.close();
- }
request.executeRequest();
request.getResponseCode();
URI redirectUrl;
@@ -208,34 +176,10 @@ TSettings getLegacyUserSettingsAtUrl(
return settings;
}
InputStream serviceResponseStream = request.getInputStream();
- // If tracing is enabled, we read the entire response into a MemoryStream so that we
- // can pass it along to the ITraceListener. Then we parse the response
- // from the MemoryStream.
- if (this.isTraceEnabledFor(TraceFlags.AutodiscoverResponse)) {
- ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
-
- while (true) {
- int data = serviceResponseStream.read();
- if (-1 == data) {
- break;
- } else {
- memoryStream.write(data);
- }
- }
- memoryStream.flush();
- this.traceResponse(request, memoryStream);
- ByteArrayInputStream memoryStreamIn = new ByteArrayInputStream(
- memoryStream.toByteArray());
- EwsXmlReader reader = new EwsXmlReader(memoryStreamIn);
- reader.read(new XmlNodeType(XmlNodeType.START_DOCUMENT));
- settings.loadFromXml(reader);
-
- } else {
- EwsXmlReader reader = new EwsXmlReader(serviceResponseStream);
- reader.read(new XmlNodeType(XmlNodeType.START_DOCUMENT));
- settings.loadFromXml(reader);
- }
+ EwsXmlReader reader = new EwsXmlReader(serviceResponseStream);
+ reader.read(new XmlNodeType(XmlNodeType.START_DOCUMENT));
+ settings.loadFromXml(reader);
serviceResponseStream.close();
} finally {
@@ -259,8 +203,7 @@ TSettings getLegacyUserSettingsAtUrl(
* @throws java.io.IOException Signals that an I/O exception has occurred.
*/
private void writeLegacyAutodiscoverRequest(String emailAddress,
- ConfigurationSettingsBase settings, PrintWriter writer)
- throws IOException {
+ ConfigurationSettingsBase settings, PrintWriter writer) {
writer.write(String.format("",
AutodiscoverRequestNamespace));
writer.write("");
@@ -568,7 +511,7 @@ TSettings internalGetLegacyUserSettings(
* @return Autodiscover URL (may be null if lookup failed)
* @throws Exception the exception
*/
- protected URI getRedirectionUrlFromDnsSrvRecord(String domainName)
+ private URI getRedirectionUrlFromDnsSrvRecord(String domainName)
throws Exception {
this
@@ -783,38 +726,20 @@ private GetUserSettingsResponseCollection getUserSettings(final List smt
EwsUtilities.validateParam(smtpAddresses, "smtpAddresses");
EwsUtilities.validateParam(settings, "settings");
- return this.getSettings(
- smtpAddresses, settings, null, this,
- new IFuncDelegate() {
- public String func() throws FormatException {
- return EwsUtilities
- .domainFromEmailAddress(smtpAddresses.get(0));
- }
- });
+ return this.getSettings(smtpAddresses, settings);
}
/**
* Gets user or domain settings using Autodiscover SOAP service.
*
- * @param the generic type
- * @param the generic type
* @param identities Either the domains or the SMTP addresses of the users.
* @param settings The settings.
- * @param requestedVersion Requested version of the Exchange service.
- * @param getSettingsMethod The method to use.
- * @param getDomainMethod The method to calculate the domain value.
* @return TGetSettingsResponse Collection.
* @throws Exception the exception
*/
- private
- TGetSettingsResponseCollection getSettings(
- List identities,
- List settings,
- ExchangeVersion requestedVersion,
- IFunctionDelegate, List,
- TGetSettingsResponseCollection> getSettingsMethod,
- IFuncDelegate getDomainMethod) throws Exception {
- TGetSettingsResponseCollection response;
+ private GetUserSettingsResponseCollection getSettings(List identities,
+ List settings) throws Exception {
+ GetUserSettingsResponseCollection response;
// Autodiscover service only exists in E14 or later.
if (this.getRequestedServerVersion().compareTo(
@@ -827,17 +752,14 @@ TGetSettingsResponseCollection getSettings(
// If Url is specified, call service directly.
if (this.url != null) {
URI autodiscoverUrl = this.url;
- response = getSettingsMethod.func(identities, settings,
- requestedVersion, this.url);
+ response = internalGetUserSettings(identities, settings, this.url);
this.url = autodiscoverUrl;
return response;
}
// If Domain is specified, determine endpoint Url and call service.
else if (!(this.domain == null || this.domain.isEmpty())) {
URI autodiscoverUrl = this.getAutodiscoverEndpointUrl(this.domain);
- response = getSettingsMethod.func(identities, settings,
- requestedVersion,
- autodiscoverUrl);
+ response = internalGetUserSettings(identities, settings, autodiscoverUrl);
// If we got this far, response was successful, set Url.
this.url = autodiscoverUrl;
@@ -848,7 +770,7 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
else {
URI autodiscoverUrl;
- String domainName = getDomainMethod.func();
+ String domainName = EwsUtilities.domainFromEmailAddress(identities.get(0));
List hosts = this.getAutodiscoverServiceHosts(domainName);
if (hosts.size() == 0) {
throw new ServiceValidationException(
@@ -859,7 +781,7 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
OutParam outParams = new OutParam();
if (this.tryGetAutodiscoverEndpointUrl(host, outParams)) {
autodiscoverUrl = outParams.getParam();
- response = getSettingsMethod.func(identities, settings, requestedVersion, autodiscoverUrl);
+ response = internalGetUserSettings(identities, settings, autodiscoverUrl);
// If we got this far, the response was successful, set Url.
this.url = autodiscoverUrl;
@@ -879,9 +801,7 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
this.tryGetAutodiscoverEndpointUrl(autodiscoverUrl
.getHost(), outParamUrl)) {
autodiscoverUrl = outParamUrl.getParam();
- response = getSettingsMethod.func(identities, settings,
- requestedVersion,
- autodiscoverUrl);
+ response = internalGetUserSettings(identities, settings, autodiscoverUrl);
// If we got this far, the response was successful, set Url.
this.url = autodiscoverUrl;
@@ -901,9 +821,7 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
this.tryGetAutodiscoverEndpointUrl(autodiscoverUrl
.getHost(), outParamUrl)) {
autodiscoverUrl = outParamUrl.getParam();
- response = getSettingsMethod.func(identities, settings,
- requestedVersion,
- autodiscoverUrl);
+ response = internalGetUserSettings(identities, settings, autodiscoverUrl);
// If we got this far, the response was successful, set Url.
this.url = autodiscoverUrl;
@@ -921,22 +839,18 @@ else if (!(this.domain == null || this.domain.isEmpty())) {
*
* @param smtpAddresses The SMTP addresses of the users.
* @param settings The settings.
- * @param requestedVersion Requested version of the Exchange service.
* @param autodiscoverUrl The autodiscover URL.
* @return GetUserSettingsResponse collection.
* @throws ServiceLocalException the service local exception
* @throws Exception the exception
*/
- private GetUserSettingsResponseCollection internalGetUserSettings(
- List smtpAddresses, List settings,
- ExchangeVersion requestedVersion,
- URI autodiscoverUrl) throws ServiceLocalException, Exception {
+ private GetUserSettingsResponseCollection internalGetUserSettings(List smtpAddresses,
+ List settings, URI autodiscoverUrl) throws ServiceLocalException, Exception {
// The response to GetUserSettings can be a redirection. Execute
// GetUserSettings until we get back
// a valid response or we've followed too many redirections.
for (int currentHop = 0; currentHop < AutodiscoverService.AutodiscoverMaxRedirections; currentHop++) {
- GetUserSettingsRequest request = new GetUserSettingsRequest(this,
- autodiscoverUrl);
+ GetUserSettingsRequest request = new GetUserSettingsRequest(this, autodiscoverUrl);
request.setSmtpAddresses(smtpAddresses);
request.setSettings(settings);
GetUserSettingsResponseCollection response = request.execute();
@@ -963,74 +877,6 @@ private GetUserSettingsResponseCollection internalGetUserSettings(
Strings.MaximumRedirectionHopsExceeded);
}
- /**
- * Gets the domain settings using Autodiscover SOAP service.
- *
- * @param domains The domains.
- * @param settings The settings.
- * @param requestedVersion Requested version of the Exchange service.
- * @return GetDomainSettingsResponse collection.
- * @throws Exception the exception
- */
- private GetDomainSettingsResponseCollection getDomainSettings(final List domains,
- List settings, ExchangeVersion requestedVersion)
- throws Exception {
- EwsUtilities.validateParam(domains, "domains");
- EwsUtilities.validateParam(settings, "settings");
-
- return this.getSettings(
- domains, settings,
- requestedVersion, this,
- new IFuncDelegate() {
- public String func() {
- return domains.get(0);
- }
- });
- }
-
- /**
- * Gets settings for one or more domains.
- *
- * @param domains The domains.
- * @param settings The settings.
- * @param requestedVersion Requested version of the Exchange service.
- * @param autodiscoverUrl The autodiscover URL.
- * @return GetDomainSettingsResponse Collection.
- * @throws ServiceLocalException the service local exception
- * @throws Exception the exception
- */
- private GetDomainSettingsResponseCollection internalGetDomainSettings(
- List domains, List settings,
- ExchangeVersion requestedVersion,
- URI autodiscoverUrl) throws ServiceLocalException, Exception {
- // The response to GetDomainSettings can be a redirection. Execute
- // GetDomainSettings until we get back
- // a valid response or we've followed too many redirections.
- for (int currentHop = 0; currentHop < AutodiscoverService.AutodiscoverMaxRedirections; currentHop++) {
- GetDomainSettingsRequest request = new GetDomainSettingsRequest(
- this, autodiscoverUrl);
- request.setDomains(domains);
- request.setSettings(settings);
- request.setRequestedVersion(requestedVersion);
- GetDomainSettingsResponseCollection response = request.execute();
-
- // Did we get redirected?
- if (response.getErrorCode() == AutodiscoverErrorCode.RedirectUrl
- && response.getRedirectionUrl() != null) {
- autodiscoverUrl = response.getRedirectionUrl();
- } else {
- return response;
- }
- }
-
- this.traceMessage(TraceFlags.AutodiscoverConfiguration, String.format(
- "Maximum number of redirection hops %d exceeded",
- AutodiscoverMaxRedirections));
-
- throw new AutodiscoverLocalException(
- Strings.MaximumRedirectionHopsExceeded);
- }
-
/**
* Gets the autodiscover endpoint URL.
*
@@ -1129,8 +975,7 @@ private List getAutodiscoverServiceUrls(String domainName)
* @throws java.net.URISyntaxException the uRI syntax exception
* @throws ClassNotFoundException the class not found exception
*/
- private List getAutodiscoverServiceHosts(String domainName) throws URISyntaxException,
- ClassNotFoundException {
+ private List getAutodiscoverServiceHosts(String domainName) throws URISyntaxException {
List urls = this.getAutodiscoverServiceUrls(domainName);
List lst = new ArrayList();
@@ -1300,11 +1145,11 @@ HttpWebRequest prepareHttpWebRequestForUrl(URI url)
*/
private boolean callRedirectionUrlValidationCallback(String redirectionUrl)
throws AutodiscoverLocalException {
- IAutodiscoverRedirectionUrl callback =
- (this.redirectionUrlValidationCallback == null) ? this
- : this.redirectionUrlValidationCallback;
- return callback
- .autodiscoverRedirectionUrlValidationCallback(redirectionUrl);
+ if (this.redirectionUrlValidationCallback != null) {
+ return redirectionUrlValidationCallback.autodiscoverRedirectionUrlValidationCallback(redirectionUrl);
+ }
+
+ return false;
}
/**
@@ -1323,119 +1168,6 @@ protected void processHttpErrorResponse(HttpWebRequest httpWebResponse,
TraceFlags.AutodiscoverResponse);
}
- /*
- * (non-Javadoc)
- *
- * @see microsoft.exchange.webservices.AutodiscoverRedirectionUrlInterface#
- * autodiscoverRedirectionUrlValidationCallback(java.lang.String)
- */
- public boolean autodiscoverRedirectionUrlValidationCallback(
- String redirectionUrl) throws AutodiscoverLocalException {
- return defaultAutodiscoverRedirectionUrlValidationCallback(
- redirectionUrl);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- public AutodiscoverService() throws ArgumentException {
- this(ExchangeVersion.Exchange2010);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param requestedServerVersion The requested server version.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- public AutodiscoverService(ExchangeVersion requestedServerVersion)
- throws ArgumentException {
- this(null, null, requestedServerVersion);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param domain The domain that will be used to determine the URL of the
- * service.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- public AutodiscoverService(String domain) throws ArgumentException {
- this(null, domain);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param domain The domain that will be used to determine the URL of the
- * service.
- * @param requestedServerVersion The requested server version.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- public AutodiscoverService(String domain,
- ExchangeVersion requestedServerVersion) throws ArgumentException {
- this(null, domain, requestedServerVersion);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param url The URL of the service.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- public AutodiscoverService(URI url) throws ArgumentException {
- this(url, url.getHost());
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param url The URL of the service.
- * @param requestedServerVersion The requested server version.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- public AutodiscoverService(URI url,
- ExchangeVersion requestedServerVersion) throws ArgumentException {
- this(url, url.getHost(), requestedServerVersion);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param url The URL of the service.
- * @param domain The domain that will be used to determine the URL of the
- * service.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- private AutodiscoverService(URI url, String domain)
- throws ArgumentException {
- super();
- EwsUtilities.validateDomainNameAllowNull(domain, "domain");
- this.url = url;
- this.domain = domain;
- this.dnsClient = new AutodiscoverDnsClient(this);
- }
-
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param url The URL of the service.
- * @param domain The domain that will be used to determine the URL of the
- * service.
- * @param requestedServerVersion The requested server version.
- * @throws microsoft.exchange.webservices.data.ArgumentException
- */
- private AutodiscoverService(URI url, String domain, ExchangeVersion requestedServerVersion) throws ArgumentException {
- super(requestedServerVersion);
- EwsUtilities.validateDomainNameAllowNull(domain, "domain");
-
- this.url = url;
- this.domain = domain;
- this.dnsClient = new AutodiscoverDnsClient(this);
- }
-
/**
* Initializes a new instance of the AutodiscoverService class.
*
@@ -1447,15 +1179,6 @@ private AutodiscoverService(URI url, String domain, ExchangeVersion requestedSer
this.dnsClient = new AutodiscoverDnsClient(this);
}
- /**
- * Initializes a new instance of the "AutodiscoverService" class.
- *
- * @param service The service.
- */
- protected AutodiscoverService(ExchangeServiceBase service) {
- super(service, service.getRequestedServerVersion());
- }
-
/**
* Retrieves the specified settings for single SMTP address.
*
@@ -1492,76 +1215,6 @@ GetUserSettingsResponse getUserSettings(String userSmtpAddress, UserSettingName.
}
- /**
- * Retrieves the specified settings for a set of users.
- *
- * @param userSmtpAddresses the user smtp addresses
- * @param userSettingNames The user setting names.
- * @return A GetUserSettingsResponseCollection object containing the
- * responses for each individual user.
- * @throws Exception the exception
- */
- public GetUserSettingsResponseCollection getUsersSettings(
- Iterable userSmtpAddresses,
- UserSettingName... userSettingNames) throws Exception {
- if (this.getRequestedServerVersion().compareTo(MinimumRequestVersionForAutoDiscoverSoapService) < 0) {
- throw new ServiceVersionException(
- String.format(Strings.AutodiscoverServiceIncompatibleWithRequestVersion,
- MinimumRequestVersionForAutoDiscoverSoapService));
- }
- List smtpAddresses = new ArrayList();
- smtpAddresses.addAll((Collection extends String>) userSmtpAddresses);
- List settings = new ArrayList();
- settings.addAll(Arrays.asList(userSettingNames));
- return this.getUserSettings(smtpAddresses, settings);
- }
-
- /**
- * Retrieves the specified settings for a domain.
- *
- * @param domain The domain.
- * @param requestedVersion Requested version of the Exchange service.
- * @param domainSettingNames The domain setting names.
- * @return A DomainResponse object containing the requested settings for the
- * specified domain.
- * @throws Exception the exception
- */
- public GetDomainSettingsResponse getDomainSettings(String domain,
- ExchangeVersion requestedVersion,
- DomainSettingName... domainSettingNames) throws Exception {
- List domains = new ArrayList(1);
- domains.add(domain);
-
- List settings = new ArrayList();
- settings.addAll(Arrays.asList(domainSettingNames));
-
- return this.getDomainSettings(domains, settings, requestedVersion).
- getTResponseAtIndex(0);
- }
-
- /**
- * Retrieves the specified settings for a set of domains.
- *
- * @param domains the domains
- * @param requestedVersion Requested version of the Exchange service.
- * @param domainSettingNames The domain setting names.
- * @return A GetDomainSettingsResponseCollection object containing the
- * responses for each individual domain.
- * @throws Exception the exception
- */
- public GetDomainSettingsResponseCollection getDomainSettings(
- Iterable domains, ExchangeVersion requestedVersion,
- DomainSettingName... domainSettingNames)
- throws Exception {
- List settings = new ArrayList();
- settings.addAll(Arrays.asList(domainSettingNames));
-
- List domainslst = new ArrayList();
- domainslst.addAll((Collection extends String>) domains);
-
- return this.getDomainSettings(domainslst, settings, requestedVersion);
- }
-
/**
* Gets the domain this service is bound to. When this property is
* set, the domain
@@ -1615,16 +1268,6 @@ public void setUrl(URI value) {
this.url = value;
}
- /**
- * Gets the redirection url validation callback.
- *
- * @return the redirection url validation callback
- */
- public IAutodiscoverRedirectionUrl
- getRedirectionUrlValidationCallback() {
- return this.redirectionUrlValidationCallback;
- }
-
/**
* Sets the redirection url validation callback.
*
@@ -1652,24 +1295,4 @@ protected String getDnsServerAddress() {
protected void setDnsServerAddress(String value) {
this.dnsServerAddress = value;
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * microsoft.exchange.webservices.FuncDelegateInterface#func(java.util.List,
- * java.util.List, java.net.URI)
- */
- @Override
- public Object func(List arg1, List arg2, ExchangeVersion arg3, URI arg4)
- throws ServiceLocalException, Exception {
- if (arg2.get(0).getClass().equals(DomainSettingName.class)) {
- return internalGetDomainSettings(arg1, arg2, arg3, arg4);
- } else if (arg2.get(0).getClass().equals(UserSettingName.class)) {
- return internalGetUserSettings(arg1, arg2, arg3, arg4);
- } else {
- return null;
- }
- }
-
}
diff --git a/src/main/java/microsoft/exchange/webservices/data/DomainSettingName.java b/src/main/java/microsoft/exchange/webservices/data/DomainSettingName.java
deleted file mode 100644
index 7c5f5988e..000000000
--- a/src/main/java/microsoft/exchange/webservices/data/DomainSettingName.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-/**
- * Domain setting names.
- */
-public enum DomainSettingName {
-
- // The external URL of the Exchange Web Services.
- /**
- * The External ews url.
- */
- ExternalEwsUrl,
-
- /// The version of the Exchange server hosting
- /// the URL of the Exchange Web Services.
- /**
- * The External ews version.
- */
- ExternalEwsVersion,
-
-
-}
diff --git a/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java b/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java
index 537baeaca..9d41361a4 100644
--- a/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java
+++ b/src/main/java/microsoft/exchange/webservices/data/ExchangeService.java
@@ -41,8 +41,7 @@
/**
* Represents a binding to the Exchange Web Services.
*/
-public final class ExchangeService extends ExchangeServiceBase implements
- IAutodiscoverRedirectionUrl {
+public final class ExchangeService extends ExchangeServiceBase {
/**
* The url.
@@ -3437,20 +3436,6 @@ public void updateInboxRules(Iterable operations,
request.execute();
}
- /**
- * Default implementation of AutodiscoverRedirectionUrlValidationCallback.
- * Always returns true indicating that the URL can be used.
- *
- * @param redirectionUrl the redirection url
- * @return Returns true.
- * @throws AutodiscoverLocalException the autodiscover local exception
- */
- private boolean defaultAutodiscoverRedirectionUrlValidationCallback(
- String redirectionUrl) throws AutodiscoverLocalException {
- throw new AutodiscoverLocalException(String.format(
- Strings.AutodiscoverRedirectBlocked, redirectionUrl));
- }
-
/**
* Initializes the Url property to the Exchange Web Services URL for the
* specified e-mail address by calling the Autodiscover service.
@@ -3459,7 +3444,7 @@ private boolean defaultAutodiscoverRedirectionUrlValidationCallback(
* @throws Exception the exception
*/
public void autodiscoverUrl(String emailAddress) throws Exception {
- this.autodiscoverUrl(emailAddress, this);
+ this.autodiscoverUrl(emailAddress, null);
}
/**
@@ -3893,17 +3878,4 @@ public Collection getServerTimeZones() {
return timeZoneList;
}
-
- /*
- * (non-Javadoc)
- *
- * @seemicrosoft.exchange.webservices.AutodiscoverRedirectionUrlInterface#
- * autodiscoverRedirectionUrlValidationCallback(java.lang.String)
- */
- public boolean autodiscoverRedirectionUrlValidationCallback(
- String redirectionUrl) throws AutodiscoverLocalException {
- return defaultAutodiscoverRedirectionUrlValidationCallback(redirectionUrl);
-
- }
-
}
diff --git a/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsRequest.java b/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsRequest.java
deleted file mode 100644
index 5a4a084f0..000000000
--- a/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsRequest.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-import javax.xml.stream.XMLStreamException;
-import java.net.URI;
-import java.util.List;
-
-/**
- * Represents a GetDomainSettings request.
- */
-class GetDomainSettingsRequest extends AutodiscoverRequest {
-
- /**
- * Action Uri of Autodiscover.GetDomainSettings method.
- */
- private static final String GetDomainSettingsActionUri =
- EwsUtilities.AutodiscoverSoapNamespace +
- "/Autodiscover/GetDomainSettings";
-
- /**
- * The domains.
- */
- private List domains;
-
- /**
- * The settings.
- */
- private List settings;
-
- private ExchangeVersion requestedVersion;
-
- /**
- * Initializes a new instance of the
- * class.
- *
- * @param service the service
- * @param url the url
- */
- protected GetDomainSettingsRequest(AutodiscoverService service, URI url) {
- super(service, url);
- }
-
- /**
- * Validates the request.
- *
- * @throws Exception the exception
- */
- @Override
- protected void validate() throws Exception {
- super.validate();
-
- EwsUtilities.validateParam(this.getDomains(), "domains");
- EwsUtilities.validateParam(this.getSettings(), "settings");
-
- if (this.getSettings().size() == 0) {
- throw new ServiceValidationException(
- Strings.InvalidAutodiscoverSettingsCount);
- }
-
- if (domains.size() == 0) {
- throw new ServiceValidationException(
- Strings.InvalidAutodiscoverDomainsCount);
- }
-
- for (String domain : this.getDomains()) {
- if (domain == null || domain.isEmpty()) {
- throw new ServiceValidationException(
- Strings.InvalidAutodiscoverDomain);
- }
- }
- }
-
- /**
- * Executes this instance.
- *
- * @return the gets the domain settings response collection
- * @throws microsoft.exchange.webservices.data.ServiceLocalException the service local exception
- * @throws Exception the exception
- */
- protected GetDomainSettingsResponseCollection execute()
- throws ServiceLocalException, Exception {
- GetDomainSettingsResponseCollection responses =
- (GetDomainSettingsResponseCollection) this
- .internalExecute();
- if (responses.getErrorCode() == AutodiscoverErrorCode.NoError) {
- this.PostProcessResponses(responses);
- }
- return responses;
- }
-
- /**
- * Post-process responses to GetDomainSettings.
- *
- * @param responses The GetDomainSettings responses.
- */
- private void PostProcessResponses(
- GetDomainSettingsResponseCollection responses) {
- // Note:The response collection may not include all of the requested
- // domains if the request has been throttled.
- for (int index = 0; index < responses.getCount(); index++) {
- responses.getResponses().get(index).setDomain(
- this.getDomains().get(index));
- }
- }
-
- /**
- * Gets the name of the request XML element.
- *
- * @return Request XML element name.
- */
- @Override
- protected String getRequestXmlElementName() {
- return XmlElementNames.GetDomainSettingsRequestMessage;
- }
-
- /**
- * Gets the name of the response XML element.
- *
- * @return Response XML element name.
- */
- @Override
- protected String getResponseXmlElementName() {
- return XmlElementNames.GetDomainSettingsResponseMessage;
- }
-
- /**
- * Gets the WS-Addressing action name.
- *
- * @return WS-Addressing action name.
- */
- @Override
- protected String getWsAddressingActionName() {
- return GetDomainSettingsActionUri;
- }
-
- /**
- * Creates the service response.
- *
- * @return AutodiscoverResponse
- */
- @Override
- protected AutodiscoverResponse createServiceResponse() {
- return new GetDomainSettingsResponseCollection();
- }
-
- /**
- * Writes the attributes to XML.
- *
- * @param writer The writer.
- * @throws ServiceXmlSerializationException the service xml serialization exception
- */
- @Override
- protected void writeAttributesToXml(EwsServiceXmlWriter writer)
- throws ServiceXmlSerializationException {
- writer.writeAttributeValue("xmlns",
- EwsUtilities.AutodiscoverSoapNamespacePrefix,
- EwsUtilities.AutodiscoverSoapNamespace);
- }
-
- /**
- * Writes request to XML.
- *
- * @param writer The writer.
- * @throws javax.xml.stream.XMLStreamException the xML stream exception
- * @throws ServiceXmlSerializationException the service xml serialization exception
- */
- @Override
- protected void writeElementsToXml(EwsServiceXmlWriter writer)
- throws XMLStreamException, ServiceXmlSerializationException {
- writer.writeStartElement(XmlNamespace.Autodiscover,
- XmlElementNames.Request);
-
- writer.writeStartElement(XmlNamespace.Autodiscover,
- XmlElementNames.Domains);
-
- for (String domain : this.getDomains()) {
- if (!(domain == null || domain.isEmpty())) {
- writer.writeElementValue(XmlNamespace.Autodiscover,
- XmlElementNames.Domain, domain);
- }
- }
- writer.writeEndElement(); // Domains
-
- writer.writeStartElement(XmlNamespace.Autodiscover,
- XmlElementNames.RequestedSettings);
- for (DomainSettingName setting : settings) {
- writer.writeElementValue(XmlNamespace.Autodiscover,
- XmlElementNames.Setting, setting);
- }
-
- writer.writeEndElement(); // RequestedSettings
-
- if (this.requestedVersion != null) {
- writer.writeElementValue(XmlNamespace.Autodiscover,
- XmlElementNames.RequestedVersion, this.requestedVersion);
- }
-
- writer.writeEndElement(); // Request
- }
-
- /**
- * Gets the domains.
- *
- * @return the domains
- */
- protected List getDomains() {
- return domains;
- }
-
- /**
- * Sets the domains.
- *
- * @param value the new domains
- */
- protected void setDomains(List value) {
- domains = value;
- }
-
- /**
- * Gets or sets the settings.
- *
- * @return the settings
- */
- protected List getSettings() {
- return settings;
- }
-
- /**
- * Sets the settings.
- *
- * @param value the new settings
- */
- protected void setSettings(List value) {
- settings = value;
- }
-
- /**
- * Gets or sets the requestedVersion.
- *
- * @return the requestedVersion
- */
- protected ExchangeVersion getRequestedVersion() {
- return requestedVersion;
- }
-
- /**
- * Sets the requestedVersion.
- *
- * @param value the new requestedVersion
- */
- protected void setRequestedVersion(ExchangeVersion value) {
- requestedVersion = value;
- }
-
-}
diff --git a/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponse.java b/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponse.java
deleted file mode 100644
index 0c5de32cb..000000000
--- a/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponse.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Represents the response to a GetDomainSettings call for an individual domain.
- */
-public final class GetDomainSettingsResponse extends AutodiscoverResponse {
-
- /**
- * The domain.
- */
- private String domain;
-
- /**
- * The redirect target.
- */
- private String redirectTarget;
-
- /**
- * The settings.
- */
- private Map settings;
-
- /**
- * The domain setting errors.
- */
- private Collection domainSettingErrors;
-
- /**
- * Initializes a new instance of the
- * class.
- */
- public GetDomainSettingsResponse() {
- super();
- this.domain = "";
- this.settings = new HashMap();
- this.domainSettingErrors = new ArrayList();
- }
-
- /**
- * Gets the domain this response applies to.
- *
- * @return the domain
- */
- public String getDomain() {
- return this.domain;
- }
-
- /**
- * Sets the domain.
- *
- * @param value the new domain
- */
- protected void setDomain(String value) {
- this.domain = value;
- }
-
- /**
- * Gets the redirectionTarget (URL or email address).
- *
- * @return the redirect target
- */
- public String getRedirectTarget() {
- return this.redirectTarget;
- }
-
- /**
- * Gets the requested settings for the domain.
- *
- * @return the settings
- */
- public Map getSettings() {
- return this.settings;
- }
-
- /**
- * Gets error information for settings that could not be returned.
- *
- * @return the domain setting errors
- */
- public Collection getDomainSettingErrors() {
- return this.domainSettingErrors;
- }
-
- /**
- * Loads response from XML.
- *
- * @param reader The reader.
- * @param endElementName End element name.
- * @throws Exception the exception
- */
- @Override
- protected void loadFromXml(EwsXmlReader reader, String endElementName)
- throws Exception {
- do {
- reader.read();
-
- if (reader.getNodeType().nodeType == XmlNodeType.START_ELEMENT) {
- if (reader.getLocalName()
- .equals(XmlElementNames.RedirectTarget)) {
- this.redirectTarget = reader.readElementValue();
- } else if (reader.getLocalName().equals(
- XmlElementNames.DomainSettingErrors)) {
- this.loadDomainSettingErrorsFromXml(reader);
- } else if (reader.getLocalName().equals(
- XmlElementNames.DomainSettings)) {
- try {
- this.loadDomainSettingsFromXml(reader);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- super.loadFromXml(reader, endElementName);
- break;
- }
- }
- } while (!reader
- .isEndElement(XmlNamespace.Autodiscover, endElementName));
- }
-
- /**
- * Loads from XML.
- *
- * @param reader The reader.
- * @throws Exception the exception
- */
- protected void loadDomainSettingsFromXml(EwsXmlReader reader)
- throws Exception {
- if (!reader.isEmptyElement()) {
- do {
- reader.read();
-
- if ((reader.getNodeType().nodeType == XmlNodeType.START_ELEMENT) &&
- (reader.getLocalName()
- .equals(XmlElementNames.DomainSetting))) {
- String settingClass = reader.readAttributeValue(
- XmlNamespace.XmlSchemaInstance,
- XmlAttributeNames.Type);
-
- if (settingClass
- .equals(XmlElementNames.DomainStringSetting)) {
-
- this.readSettingFromXml(reader);
- } else {
- EwsUtilities
- .EwsAssert(
- false,
- "GetDomainSettingsResponse." +
- "LoadDomainSettingsFromXml",
- String
- .format(
- "%s,%s",
- "Invalid setting " +
- "class '%s' returned",
- settingClass));
- break;
- }
- }
- } while (!reader.isEndElement(XmlNamespace.Autodiscover,
- XmlElementNames.DomainSettings));
- } else {
- reader.read();
- }
- }
-
- /**
- * Reads domain setting from XML.
- *
- * @param reader The reader.
- * @throws Exception the exception
- */
- private void readSettingFromXml(EwsXmlReader reader) throws Exception {
- DomainSettingName name = null;
- Object value = null;
-
- do {
- reader.read();
-
- if (reader.getNodeType().nodeType == XmlNodeType.START_ELEMENT) {
- if (reader.getLocalName().equals(
- XmlElementNames.DomainStringSetting)) {
- name = reader.readElementValue(DomainSettingName.class);
- } else if (reader.getLocalName().equals(XmlElementNames.Value)) {
- value = reader.readElementValue();
- }
- }
- } while (!reader.isEndElement(XmlNamespace.Autodiscover,
- XmlElementNames.DomainSetting));
-
- EwsUtilities.EwsAssert(name != null,
- "GetDomainSettingsResponse.ReadSettingFromXml",
- "Missing name element in domain setting");
-
- this.settings.put(name, value);
- }
-
- /**
- * Loads the domain setting errors.
- *
- * @param reader The reader.
- * @throws Exception the exception
- */
- private void loadDomainSettingErrorsFromXml(EwsXmlReader reader)
- throws Exception {
- if (!reader.isEmptyElement()) {
- do {
- reader.read();
-
- if ((reader.getNodeType().nodeType == XmlNodeType.START_ELEMENT) &&
- (reader.getLocalName()
- .equals(XmlElementNames.DomainSettingError))) {
- DomainSettingError error = new DomainSettingError();
- error.loadFromXml(reader);
- domainSettingErrors.add(error);
- }
- } while (!reader.isEndElement(XmlNamespace.Autodiscover,
- XmlElementNames.DomainSettingErrors));
- } else {
- reader.read();
- }
- }
-}
diff --git a/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponseCollection.java b/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponseCollection.java
deleted file mode 100644
index b8f58f2c4..000000000
--- a/src/main/java/microsoft/exchange/webservices/data/GetDomainSettingsResponseCollection.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-/**
- * Represents a collection of responses to GetDomainSettings.
- */
-public final class GetDomainSettingsResponseCollection extends
- AutodiscoverResponseCollection {
-
- /**
- * Initializes a new instance of the AutodiscoverResponseCollection class.
- */
- protected GetDomainSettingsResponseCollection() {
- }
-
- /**
- * Create a response instance.
- *
- * @return GetDomainSettingsResponse.
- */
- @Override
- protected GetDomainSettingsResponse createResponseInstance() {
- return new GetDomainSettingsResponse();
- }
-
- /**
- * Gets the name of the response collection XML element.
- *
- * @return Response collection XMl element name.
- */
- @Override
- protected String getResponseCollectionXmlElementName() {
- return XmlElementNames.DomainResponses;
- }
-
- /**
- * Gets the name of the response instance XML element.
- *
- * @return Response instance XMl element name.
- */
- @Override
- protected String getResponseInstanceXmlElementName() {
- return XmlElementNames.DomainResponse;
- }
-
-}
diff --git a/src/main/java/microsoft/exchange/webservices/data/IFunctionDelegate.java b/src/main/java/microsoft/exchange/webservices/data/IFunctionDelegate.java
deleted file mode 100644
index 29225d818..000000000
--- a/src/main/java/microsoft/exchange/webservices/data/IFunctionDelegate.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-
-/**
- * The Interface FuncDelegateInterface.
- *
- * @param the generic type
- * @param the generic type
- * @param the generic type
- * @param the generic type
- */
-interface IFunctionDelegate, T2 extends List>, TResult> {
-
- /**
- * Func.
- *
- * @param arg1 the arg1
- * @param arg2 the arg2
- * @param arg3 the arg3
- * @return the t result
- * @throws AutodiscoverLocalException the autodiscover local exception
- * @throws javax.xml.stream.XMLStreamException the xML stream exception
- * @throws java.io.IOException Signals that an I/O exception has occurred.
- * @throws ServiceLocalException the service local exception
- * @throws Exception the exception
- */
- TResult func(T1 arg1, T2 arg2, ExchangeVersion arg3, URI arg4)
- throws AutodiscoverLocalException, XMLStreamException, IOException,
- ServiceLocalException, Exception;
-
-}
diff --git a/src/test/java/microsoft/exchange/webservices/data/GetUserSettingsRequestTest.java b/src/test/java/microsoft/exchange/webservices/data/GetUserSettingsRequestTest.java
deleted file mode 100644
index b42a814b2..000000000
--- a/src/test/java/microsoft/exchange/webservices/data/GetUserSettingsRequestTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * The MIT License
- * Copyright (c) 2012 Microsoft Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package microsoft.exchange.webservices.data;
-
-
-import org.hamcrest.core.IsNot;
-import org.hamcrest.core.IsNull;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.ByteArrayOutputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Testclass for methods of GetUserSettingsRequest
- */
-@RunWith(Parameterized.class)
-public class GetUserSettingsRequestTest extends BaseTest {
-
- /**
- * The ExchangeVersion which is under test
- */
- private final ExchangeVersion exchangeVersion;
-
- /**
- * The AutodiscoverService which is under test
- */
- private final AutodiscoverService autodiscoverService;
-
- /**
- * A mocked URI via HTTPS
- */
- private final URI uriMockHttps = URI.create("https://localhost");
-
- /**
- * A mocked URI via HTTP
- */
- private final URI uriMockHttp = URI.create("http://localhost");
-
- /**
- * Returns the Parameters which where handled to the constructor
- *
- * @return the available Services
- * @throws ArgumentException
- */
- @Parameterized.Parameters
- public static List