From 2c98834566bc38df7a4289bfca96788664278d28 Mon Sep 17 00:00:00 2001 From: bobo Date: Tue, 18 Mar 2025 14:37:28 +0800 Subject: [PATCH 1/5] v2.2.0 support JDK17 --- pom.xml | 23 +++++++++++++++---- readme.md | 2 ++ .../data/core/request/ServiceRequestBase.java | 2 +- .../ExecuteDiagnosticMethodResponse.java | 6 ++--- .../data/property/complex/TimeChange.java | 2 +- .../data/property/complex/TimeChangeTest.java | 2 +- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index e303359bc..5cfd82c60 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ com.microsoft.ews-java-api ews-java-api - 2.1-SNAPSHOT + 2.2.0 Exchange Web Services Java API Exchange Web Services (EWS) Java API @@ -76,7 +76,7 @@ UTF-8 - 1.6 + 17 @@ -86,12 +86,12 @@ 3.3 1.6.5 2.4 - 1.14 + 1.24 1.1 3.4 - 2.8 - 2.2 + 2.9 + 2.18.0 2.5 2.18.1 0.7.5.201505241946 @@ -102,6 +102,7 @@ 2.8 3.4 2.4 + 3.0.1 4.12 1.3 @@ -249,6 +250,18 @@ ${joda-time.version} + + jakarta.xml.bind + jakarta.xml.bind-api + ${jakarta-xml.version} + + + + jakarta.xml.ws + jakarta.xml.ws-api + ${jakarta-xml.version} + + junit junit diff --git a/readme.md b/readme.md index 6101807c8..b9c82f9d7 100644 --- a/readme.md +++ b/readme.md @@ -9,6 +9,8 @@ By using the EWS Java API, you can access almost all the information stored in a ## Support statement +support JDK 17 since 2.2 + Starting July 19th 2018, Exchange Web Services (EWS) will no longer receive feature updates. While the service will continue to receive security updates and certain non-security updates, product design and features will remain unchanged. This change also applies to the EWS SDKs for Java and .NET. More information here: https://developer.microsoft.com/en-us/graph/blogs/upcoming-changes-to-exchange-web-services-ews-api-for-office-365/ diff --git a/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java b/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java index aafd48cf6..0c2f7ad9e 100644 --- a/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java +++ b/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java @@ -51,7 +51,7 @@ import org.apache.commons.logging.LogFactory; import javax.xml.stream.XMLStreamException; -import javax.xml.ws.http.HTTPException; +import jakarta.xml.ws.http.HTTPException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/microsoft/exchange/webservices/data/core/response/ExecuteDiagnosticMethodResponse.java b/src/main/java/microsoft/exchange/webservices/data/core/response/ExecuteDiagnosticMethodResponse.java index f67322ab0..134aaff44 100644 --- a/src/main/java/microsoft/exchange/webservices/data/core/response/ExecuteDiagnosticMethodResponse.java +++ b/src/main/java/microsoft/exchange/webservices/data/core/response/ExecuteDiagnosticMethodResponse.java @@ -125,9 +125,9 @@ public Document retriveDocument(XMLEventReader xmlEventReader) } String xmlns = EwsUtilities.WSTrustFebruary2005Namespace;//"http://schemas.xmlsoap.org/wsdl/"; - ite = ele.getNamespaces(); - while (ite.hasNext()) { - Namespace ns = (Namespace) ite.next(); + Iterator ite2 = ele.getNamespaces(); + while (ite2.hasNext()) { + Namespace ns = (Namespace) ite2.next(); String name = ns.getPrefix(); if (!name.isEmpty()) { element.setAttributeNS(xmlns, name, diff --git a/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java b/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java index b1186cf73..b38d19a27 100644 --- a/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java +++ b/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java @@ -40,7 +40,7 @@ import java.util.Date; import java.util.TimeZone; -import javax.xml.bind.DatatypeConverter; +import jakarta.xml.bind.DatatypeConverter; /** * Represents a change of time for a time zone. diff --git a/src/test/java/microsoft/exchange/webservices/data/property/complex/TimeChangeTest.java b/src/test/java/microsoft/exchange/webservices/data/property/complex/TimeChangeTest.java index 6346bacf6..829cc4683 100644 --- a/src/test/java/microsoft/exchange/webservices/data/property/complex/TimeChangeTest.java +++ b/src/test/java/microsoft/exchange/webservices/data/property/complex/TimeChangeTest.java @@ -23,7 +23,7 @@ import java.util.Calendar; import java.util.TimeZone; -import javax.xml.bind.DatatypeConverter; +import jakarta.xml.bind.DatatypeConverter; import microsoft.exchange.webservices.data.core.EwsUtilities; import microsoft.exchange.webservices.data.misc.Time; From 14b59e46f7ee1591f845325b67b2a51fd0e4cbba Mon Sep 17 00:00:00 2001 From: bobo Date: Tue, 18 Mar 2025 14:52:37 +0800 Subject: [PATCH 2/5] dev 106 --- pom.xml | 319 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 182 insertions(+), 137 deletions(-) diff --git a/pom.xml b/pom.xml index 5cfd82c60..00d19a460 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,8 @@ should probably be UTF-8 nowadays. --> UTF-8 17 + 17 + 17 @@ -112,70 +114,112 @@ + - - default-jdk18-profile - - [1.8,) - - - -Xdoclint:none - + devCoding + + + openea-reps-mvn + mvn + https://openea-maven.pkg.coding.net/repository/reps/mvn/ + + - - java-7-or-later-profile + dev106 - [1.7,) + + true - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - true - google_checks.xml - - - - verify - - checkstyle - - - - - - + + + dev + + + + dev106-nexus + dev106-nexus + http://192.168.8.106:8081/repository/maven-releases/ + + + + + nexus-bpm-core + bpm-core-nexus + http://10.9.8.162:8081/repository/maven-public/ + + true + + + true + + + - release-sign-artifacts + + default-jdk18-profile - - gpg.passphrase - + [1.8,) - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven-gpg-plugin.version} - - - sign-artifacts - verify - - sign - - - - - - + + -Xdoclint:none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -309,18 +353,18 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - true - - - true - ossrh - https://oss.sonatype.org/ - - + + + + + + + + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -331,77 +375,78 @@ ${javaLanguage.version} - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - true - ${javadoc.doclint.param} - - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - - - attach-sources - - jar-no-fork - - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - ${animal-sniffer-maven-plugin.version} - - - org.codehaus.mojo.signature - java16-sun - ${animal-sniffer-maven-plugin.signature.version} - - - - - check-java16-sun - test - - check - - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - - prepare-agent - - - - report - test - - report - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - devCoding - - - openea-reps-mvn - mvn - https://openea-maven.pkg.coding.net/repository/reps/mvn/ - - - - - dev106 + + jdk17-profile - - true + [17,) - - dev + -Xdoclint:none - - - dev106-nexus - dev106-nexus - http://10.9.8.162:8081/repository/maven-releases/ - - - - - nexus-bpm-core - bpm-core-nexus - http://10.9.8.162:8081/repository/maven-public/ - - true - - - true - - - - default-jdk18-profile + jdk8-profile - [1.8,) + [1.8,17) -Xdoclint:none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 2b121167b1e3546ee9b7304790bfa7043ef3a6f2 Mon Sep 17 00:00:00 2001 From: dev9-bb Date: Sun, 17 Aug 2025 11:29:20 +0800 Subject: [PATCH 5/5] =?UTF-8?q?update=20=E9=A1=B9=E7=9B=AE=E4=BB=8B?= =?UTF-8?q?=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...00\346\237\245\346\212\245\345\221\212.md" | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 "doc/\351\241\271\347\233\256\346\243\200\346\237\245\346\212\245\345\221\212.md" diff --git "a/doc/\351\241\271\347\233\256\346\243\200\346\237\245\346\212\245\345\221\212.md" "b/doc/\351\241\271\347\233\256\346\243\200\346\237\245\346\212\245\345\221\212.md" new file mode 100644 index 000000000..3bb215ef4 --- /dev/null +++ "b/doc/\351\241\271\347\233\256\346\243\200\346\237\245\346\212\245\345\221\212.md" @@ -0,0 +1,170 @@ +# EWS Java API 项目检查报告 + +## 项目概述 + +`` 是微软官方提供的 Exchange Web Services (EWS) Java API 库,用于开发与 Microsoft Exchange 服务器交互的 Java 应用程序。 + +## 项目基本信息 + +### 版本信息 + +- **当前版本**: 2.2.0 +- **开发商**: Microsoft Corporation +- **许可证**: MIT License +- **开发起始**: 2012年 +- **Java版本要求**: JDK 17 +- **编码格式**: UTF-8 + +### 项目状态 + +- **维护状态**: 维持模式(Sustaining Mode) +- **功能更新**: 自2018年7月起停止新功能开发 +- **推荐替代方案**: Microsoft Graph API + +## 技术架构分析 + +### 核心组件 + +1. **``** + + - 主要的服务类,提供与Exchange服务器的连接和操作接口 + - 继承自 `` + - 支持两种构造方式:默认构造函数和指定Exchange版本的构造函数 +2. **支持的Exchange版本** + + - Exchange 2007 SP1 + - Exchange 2010 + - Exchange 2010 SP1 + - Exchange 2010 SP2 + +### 主要功能模块 + +1. **邮件操作** + + - 发送、接收、删除邮件 + - 邮件附件处理 + - 邮件搜索和过滤 +2. **文件夹管理** + + - 创建、更新、复制、移动文件夹 + - 文件夹搜索和属性加载 +3. **日历功能** + + - 会议和约会管理 + - 日历视图和搜索 +4. **联系人管理** + + - 联系人信息处理 + - 通讯录操作 +5. **自动发现服务** + + - 自动配置Exchange服务器连接 + - SCP(Service Connection Point)查找 +6. **通知服务** + + - Pull通知 + - Push通知 + - 流式通知 + +### 依赖库分析 + +#### 核心依赖 + +```xml + + + org.apache.httpcomponents + httpclient + + + + + joda-time + joda-time + + + + + jakarta.xml.bind + jakarta.xml.bind-api + + + + + org.apache.commons + commons-lang3 + +``` + +## 在项目中的使用情况 + +### 实际应用场景 + +1. **``** + + - 用于企业邮件系统集成 + - 支持指定用户凭据的邮件发送 + - 配置了SSL连接和超时设置 +2. **``** + + - 计划系统的邮件服务 + - 使用Exchange 2010 SP1版本 + +### 配置示例 + +```java +// 创建Exchange服务实例 +ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1); + +// 设置用户凭据 +ExchangeCredentials credentials = new WebCredentials(username, password, "AD01"); +service.setCredentials(credentials); + +// 配置服务器URL +service.setUrl(new URI("https://webmail.shanghai-electric.com/EWS/Exchange.asmx")); + +// 设置超时时间 +service.setTimeout(5000); +``` + +## 安全性分析 + +### 优势 + +- 支持多种认证方式 +- SSL/TLS加密通信 +- 官方维护的稳定库 + +### 注意事项 + +- 需要正确配置SSL证书验证 +- 用户凭据需要安全存储 +- 建议使用连接池管理 + +## 测试覆盖 + +项目包含完整的测试套件: + +- 单元测试覆盖核心功能 +- 模拟测试环境 +- 使用JUnit 4框架 +- 包含Mockito用于模拟对象 + +## 建议和改进方向 + +### 短期建议 + +1. **版本升级**: 考虑迁移到Microsoft Graph API +2. **安全加固**: 加强SSL配置和证书验证 +3. **连接管理**: 优化HTTP连接池配置 +4. **错误处理**: 完善异常处理机制 + +### 长期规划 + +1. **API迁移**: 逐步迁移到Microsoft Graph API +2. **现代化改造**: 使用更现代的HTTP客户端 +3. **云原生支持**: 支持Office 365和Exchange Online + +## 总结 + +EWS Java API 是一个成熟稳定的Exchange集成库,在企业环境中被广泛使用。虽然微软已停止新功能开发,但对于现有的Exchange Server环境仍然是可靠的选择。建议在新项目中考虑使用Microsoft Graph API,对于现有项目可以继续使用但需要关注安全性和性能优化。