Access to multiple versions of a package in Java

We have several applications that use the Apache 3 HTTP client to create HTTP requests. Recently, we also started creating web service clients that use HTTPClient 4 for various reasons. Apache's position is that "major releases do not support backward compatibility." Although I would like to update all of our projects to use version 4, this is simply not possible.

So, although my main question is pretty general, my specific question. How to use HTTPClient versions 3 and 4 in one application? In our case, the application can be a web interface, a desktop, or a command line.

I read the SO question for java-dynamic-load-multiple-versions-of-same-class , which seems to be semi-closed, but I don't care much about the dynamic part. Actually, I would like JARs to be sent using an application (like WEB-INF / lib for web applications), I also see OSGi mentioned a lot in issues like this, but it seems like it is excessive or maybe too complicated (maybe a simple example can prove the opposite).

In the end, I want to be able to give the team a set of banners that they can fall into, and it just works regardless of my project using HTTP Client 3.

+5
source share
4

, . .

, " ", v3 , v4 . ... ?

OSGi , . OSGi - , , , , , . OSGi OSGi. OSGi , .

+5

, HttpClient3 HttpClient4 -

org.apache.commons.httpclient3 HttpClient3 org.apache.commons.httpclient4 HttpClient4, . , , .

, .

+2

, HTTP-, .

- URLClassLoader . , , HTTP- ( , ).

+1

v3 v4. v3 v4 . URLClassLoadedr . URL-, , URL- HTTP-.

? , , . , . , .

+1

All Articles