Restlet 1.1 and Restlet 2.0 coexistence

10 messages Options
Embed this post
Permalink
Sanjay Acharya

Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I am curious regarding how and whether the Restlet 1.1 and Restlet 2.0 libraries can be used concurrently in an application.

For the sake of discussion if I have a Web Service that is running Restlet 1.1 code and corresponding modues, can I have within the web app a client that uses Restlet 2.0 classes to talk to another service?
Or a Web Application that has two clients, one using Restlet 1.1 and another using Restlet 2.0?

During an upgrade from 1.1 to 2.0, as we cannot gurantee all projects to be upgraded at the same time, I am curious regarding any binary incompatibility issues that might arise?

In short can Restlet 1.1 and Restlet 2.0 code simulataneously co-exist or is it one or the other?

Thanks,
Sanjay


Bing brings you health info from trusted sources. Try it now!
jlouvel

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Hi Sanjay,

 

The Restlet API has changed between 1.1 and 2.0 in way that make the manual upgrade relatively easy (except for class movings) but they are not binary compatible.

 

In your case, I suggest that you isolate your 1.1 and 2.0 applications. To do this, it depends on the way you deploy your Restlet apps, JEE or JSE. In the latest case, you will need two JVMs.

 

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~
http://www.noelios.com

 

 

 

 

De : Sanjay Acharya [mailto:[hidden email]]
Envoyé : lundi 21 septembre 2009 18:53
À : [hidden email]
Objet : Restlet 1.1 and Restlet 2.0 coexistence

 

I am curious regarding how and whether the Restlet 1.1 and Restlet 2.0 libraries can be used concurrently in an application.

For the sake of discussion if I have a Web Service that is running Restlet 1.1 code and corresponding modues, can I have within the web app a client that uses Restlet 2.0 classes to talk to another service?
Or a Web Application that has two clients, one using Restlet 1.1 and another using Restlet 2.0?

During an upgrade from 1.1 to 2.0, as we cannot gurantee all projects to be upgraded at the same time, I am curious regarding any binary incompatibility issues that might arise?

In short can Restlet 1.1 and Restlet 2.0 code simulataneously co-exist or is it one or the other?

Thanks,
Sanjay


Bing brings you health info from trusted sources. Try it now!

jlouvel

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Sanjay,

It IS possible if you deploy your Restlet applications in a Java EE
container which properly isolates each WAR in its own classloader or in an
OSGi container.

The Restlet 1.1 branch will be supported until the Restlet 2.1 M1 is
released. See our roadmap for details: http://www.restlet.org/about/roadmap

If you need longer support life, you can also subscribe to one of our
professional support plans: http://www.noelios.com/products/support

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]]
Envoyé : jeudi 29 octobre 2009 17:40
À : Jerome Louvel
Objet : RE: Restlet 1.1 and Restlet 2.0 coexistence

Hi Jerome,

If I understand you correctly, due to binary incompatibility it is not
possible to have both 1.1 and 2.0 together. The break in binary
compatibility makes it hard for my organization to upgrade to 2.0. I have
tried the same and due to class loading orders, I encounter incompatibility.

In our organization we have service clients using Restlet are sometimes
deployed on other services. It will not be possible for us to migrate all
services and clients simultaneously. In addition, providing two separate
service clients, one using 1.1.X and a second that uses 2.0 will be burden
on the development teams. I am hoping to find a simpler upgrade path that
will allow for the coexistence of the two versions of the framework for the
time of the transition.

What is the time line for the existence and support of 1.1.X from Restlet?

If you have any other recommendations, the same would be appreciated.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413782
Sanjay Acharya

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Jerome thanks much for the update. We do not employ a Servlet container for our needs and it does isolate each WAR in its own classloader. However, the issue is when service clients (jars) are used within the WAR with different Restlet versions (1.1.X and 2.X), we run into the Class loading issue regardless. As an example, of a Service client:

public interface OrderClient {
  public Long createOrder(Order order);
}

public class OrderClientImpl implements OrderClient {
  private final Client client;
  ....
  public Long createOrder(Order order) {
    client.post(....);
  }
}

Regarding OSGI, we might need to look into the same.

I am curious regarding Restlet's decision to not be backward binary compatible with 1.1 and have a gradual phase out of 1.1 code ?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413869
jlouvel

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Hi Sanjay,

Ah! If your issue is only on the client side, then a Restlet 2.0 client
could perfectly access both Restlet 1.1 and 2.0 servers as the interaction
is based on HTTP.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Sanjay Acharya [mailto:[hidden email]]
Envoyé : lundi 2 novembre 2009 17:21
À : [hidden email]
Objet : RE: Restlet 1.1 and Restlet 2.0 coexistence

Jerome thanks much for the update. We do not employ a Servlet container for
our needs and it does isolate each WAR in its own classloader. However, the
issue is when service clients (jars) are used within the WAR with different
Restlet versions (1.1.X and 2.X), we run into the Class loading issue
regardless. As an example, of a Service client:

public interface OrderClient {
  public Long createOrder(Order order);
}

public class OrderClientImpl implements OrderClient {
  private final Client client;
  ....
  public Long createOrder(Order order) {
    client.post(....);
  }
}

Regarding OSGI, we might need to look into the same.

I am curious regarding Restlet's decision to not be backward binary
compatible with 1.1 and have a gradual phase out of 1.1 code ?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24138
69

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413882
webpost

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
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
webpost

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
In reply to this post by Sanjay Acharya
Jerome to illustrate the problem where one faces binary incompatibility, let me provide an example as well:

// Uses 1.1.X of Restlet
public class FooClient {
    private final Client client
       = new Client(Protocol.HTTP);
   
    public void foo() {
     Request request = new Request(Method.GET, "http://localhost:9090/foo");
     Response resp = client.handle(request);
     System.out.println("Entity:" + resp.getEntity());
    }
  }
}

// Uses 2.X of Restlet
public class BarClient {
    private final Client client
       = new Client(Protocol.HTTP);
   
    public void bar() {
     Request request = new Request(Method.GET, "http://localhost:9091/bar");
     Response resp = client.handle(request);
     System.out.println("Entity:" + resp.getEntity());
    }
  }
}

A simple java application that uses both these clients. The same could also have been a webapp easily:
public class Test {
   public static void main() {
     FooClient f = new FooClient();
     BarClient b = new BarClient();
     
     f.foo();
     b.bar();    
   }
}

Binary incompatibility:
java.lang.NoSuchMethodError: org.restlet.data.Response.getEntity()Lorg/restlet/resource/Representation;

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413939
jlouvel

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
In reply to this post by webpost
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.org
Noelios 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=24139
01

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2414046
Sanjay Acharya

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Hi Jerome,

Again thanks for your response. We use Restlet extensively and have many services with the same. Some services are composite in that they use one or more other services as well. As all our services are internal, the service clients are maintained by the creators of the service and thus try to be as DRY as possible.

Maintaining two versions of a Service Client during the upgrade process can be hard and will break DRY.

We were hoping for transitional process that would allow people time to upgrade. Our culture tries very much to guarantee backward compatibility over at least two releases of any software.

Anyway, it appears that combining Restlet 1.1.X and Restlet 2.0.X binaries is not an option. Looks like we have some challenges ahead :-)

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2414140
jlouvel

RE: Restlet 1.1 and Restlet 2.0 coexistence

Reply Threaded More More options
Print post
Permalink
Hi Sanjay,

With the constraints you express it looks like a challenge indeed... Unless
you can isolate each part of your client application in a separate WAR (or
OSGi bundle) you will need to rely on a single Restlet version on the client
side.

BTW, in Restlet 2.0 I recommend leveraging the ClientResource class which
offers higher level features than a raw Client connector such as
object-representation transparent conversion, automatic redirection
following or retry attempts in case of recoverable communication errors. It
is also more convenient if you need to issue several calls to the same
target resource.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



-----Message d'origine-----
De : Sanjay Acharya [mailto:[hidden email]]
Envoyé : mardi 3 novembre 2009 16:51
À : [hidden email]
Objet : RE: Restlet 1.1 and Restlet 2.0 coexistence

Hi Jerome,

Again thanks for your response. We use Restlet extensively and have many
services with the same. Some services are composite in that they use one or
more other services as well. As all our services are internal, the service
clients are maintained by the creators of the service and thus try to be as
DRY as possible.

Maintaining two versions of a Service Client during the upgrade process can
be hard and will break DRY.

We were hoping for transitional process that would allow people time to
upgrade. Our culture tries very much to guarantee backward compatibility
over at least two releases of any software.

Anyway, it appears that combining Restlet 1.1.X and Restlet 2.0.X binaries
is not an option. Looks like we have some challenges ahead :-)

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24141
40

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2416436