Hello,
I wouldn't recommend trying to mix Restlet classes from 1.1 and 2.0 versions
in the same client application. Even if you manage to make them cohabit, it
seems pretty fragile as you experienced.
I'm just wondering why you can't just use either 1.1 or 2.0 version (not
both at the same time) in this client application? It doesn't matter if the
backend services they are talking to are based on Restlet 1.1 or 2.0 as they
only see them as HTTP servers.
I'm probably still missing your point?
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~
http://www.restlet.orgNoelios Technologies ~ Co-founder ~
http://www.noelios.com-----Message d'origine-----
De :
[hidden email] [mailto:
[hidden email]]
Envoyé : lundi 2 novembre 2009 19:08
À :
[hidden email]
Objet : RE: Restlet 1.1 and Restlet 2.0 coexistence
Jerome, sadly it is not so simple as one web app can have two separate
service clients, one client that talks to a service Foo that was developed
using 1.1.X and a second that talks to service Bar developed using 2.0.
WebApp
|_ Foo Client (talks to service Foo) uses Restlet 1.1 packages
|
|_ Bar Client (talks to service Bar) uses Restlet 2.0 packages
Due to refactoring of the Restlet packages, we need to include both versions
of org.restlet module in our code. The same can be accomplished via renaming
the 1.1.X jar.
The challenge I am facing is due to class loading orders that can cause
incompatibilities.
For example, we have a Client from Restlet 2.0 which loads Engine from the
same version of Restlet. In our case we have a customized version of
HttpClientHelper, ExtendedHttpClientHelper which extends Restlet 1.1
HttpClientHelper and is defined in META-INF/services of Foo Client.
Now when the Restlet 2.0 Engine class loads the ExtendedHttpClientHelper, it
tries to cast it to org.restlet.engine.ClientHelper causing a class cast.
One way would be to maintain two separate versions of every service client,
one that is on 1.1 and the second on 2.0. That however would prove to be a
burden on our development team.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413901
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2414046