简体   繁体   English

将Apache httpcomponents从4.1.x升级到4.3.x

[英]Upgrade Apache httpcomponents from 4.1.x to 4.3.x

My current java project, which is sort of old, is using Apache httpcomponents jars of version 4.1.x. 我当前的Java项目有点旧,正在使用4.1.x版的Apache httpcomponents jar。

Now I would like to introduce some new features into my project, which should use version of 4.3.x. 现在,我想在我的项目中引入一些新功能,这些新功能应该使用4.3.x版本。

My questions is how to upgrade the httpcomponents to new version and make sure it wouldn't break the old codes without going through the whole project. 我的问题是如何将httpcomponents升级到新版本,并确保不经历整个项目就不会破坏旧代码。 (The project is huge, and lots of places depends on old versions). (该项目很大,很多地方取决于旧版本)。

Could anyone that give ideas of how the httpcomponents APIs have changed over time? 谁能提供有关httpcomponents API如何随时间变化的想法?

All GA versions of HC 4.x are expected to be fully backward compatible. HC 4.x的所有GA版本都应完全向后兼容。 One should be able to drop 4.3 in place of 4.1 without breaking existing code (*). 一个人应该能够在不破坏现有代码(*)的情况下将4.3替换为4.1。 At the same time deprecated code tends to be regression tested much less rigorously, so it is generally recommended to migrate to non-deprecated functionality after an upgrade. 同时,不推荐使用的代码往往要经过更严格的回归测试,因此通常建议在升级后迁移到不推荐使用的功能。

(*) Some code deprecated prior to 4.0 GA has been removed in 4.2 GA (*)在4.2 GA中已删除了4.0 GA 之前不建议使用的某些代码

The best thing would be to have have some good unit and integration tests that would catch any integration problems. 最好的办法是进行一些良好的单元和集成测试,以解决所有集成问题。 You should also look at the release notes and see if you are dependent upon any behavior that has changed between those minor version changes. 您还应该查看发行说明 ,看看您是否依赖这些次要版本更改之间已更改的任何行为。 There is several sections titled "Incompatible changes" that you should check and see if you depend on the behavior there. 您应该检查几个标题为“不兼容的更改”的部分,以查看是否依赖那里的行为。

For example, under Release 4.2 : 例如,在版本4.2下

Incompatible changes 不兼容的更改


[Compared to release version 4.1.4] [与发行版4.1.4比较]

The following methods have been deprecated for some time now and have been deleted: 以下方法已被弃用一段时间,并已删除:

org.apache.http.impl.SocketHttpServerConnection#createHttpDataReceiver(Socket, int, HttpParams) org.apache.http.impl.SocketHttpServerConnection#createHttpDataTransmitter(Socket, int, HttpParams) org.apache.http.protocol.HttpRequestHandlerRegistry#matchUriRequestPattern(String, String) org.apache.http.impl.SocketHttpServerConnection#createHttpDataReceiver(Socket,int,HttpParams)org.apache.http.impl.SocketHttpServerConnection#createHttpDataTransmitter(Socket,int,HttpParams)org.apache.http.protocol.HttpRequestHandlerRegistry#matchUriRequestPattern(String,串)

The following classes have been deprecated for some while now and have been deleted: 以下类已经过时了一段时间,已被删除:

org.apache.http.nio.entity.ByteArrayNIOEntity org.apache.http.nio.entity.FileNIOEntity org.apache.http.nio.entity.HttpNIOEntity org.apache.http.nio.entity.StringNIOEntity org.apache.http.nio.protocol.NHttpClientHandlerBase org.apache.http.nio.protocol.NHttpServiceHandlerBase org.apache.http.nio.entity.ByteArrayNIOEntity org.apache.http.nio.entity.FileNIOEntity org.apache.http.nio.entity.HttpNIOEntity org.apache.http.nio.entity.StringNIOEntity org.apache.http。 nio.protocol.NHttpClientHandlerBase org.apache.http.nio.protocol.NHttpServiceHandlerBase

Since it is only a minor version bump and, I believe, the project follows semantic versioning , there should only be added functionality in a backwards-compatible manner. 由于这只是次要版本,我相信该项目遵循语义版本控制 ,因此只能以向后兼容的方式添加功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM