Closed Isfirs closed 4 years ago
oh, I'll need to include this in a major release as it's a breaking change. I've been meaning to get Unirest fully compliant with 11
How are the plans regarding the http client? Stick to Apache HTTP? Convert to java.net.http module?
The idea is to eventually support java.net.http as an option. I don't think it's quite a feature rich as Apache and likely wouldn't support all of the things apache does without Unirest augmenting a lot of that. One of the guiding rules of Unirest is to hide as much of Apache as possible. there are still a few leaky spots. but yea, once we get to 11 we would probably split the underlying implementations out into modules with java.net.http being the default.
My first goal before that is to support Apache HttpClient 5 because that gives us the fastest route to support all of the features and add Http2
I forked Unirest and prepared a branch feature/java-11
where I moved everything into seperate modules so far.
The main idea in that setup is to "force" to the user to choose a client implementation he wants to use. That is done by using the ServiceLoader
API which loads services using the module-info specification, where it explicitly states what service interfaces are exposed. Modules can then choose to expose an implementation.
I came up to some problems I have to refactor. Especially drop deprecated code. One goal is to not expose Apache from Unirest and only use own interfaces. Hence, in the fork you can see has a new interface for Interceptors.
If wanted, I can open a PR so you can comment on my commits and code changes. But that is up to you.
The interceptors can just be removed, they have been replaced by a Unirest interceptor pattern. Yea sure. do a PR and I'll take a look
the repackaging is done in 3.5.00, I also have an 11 branch now to make sure everything continue to work in 11, Probably need to get the GitHub actions script to just run both verifies every time.
The package
kong.unirest
is used in the main Unirest as well as in the jackson and gson mapper.Using this as automated modules in java 11 causes an error. It is not allowed to expose the same package from multiple modules.
A solution would be to move both mappers to subpackages according to their purpose, hence
kong.unirest.mapper.gson
andkong.unirest.mapper.jackson
could suit well.