-------- Messaggio Inoltrato --------
Oggetto: Re: [Resteasy-developers] Upgrading a client proxy from v2 to v3
Data: Tue, 10 Jan 2017 17:52:55 +0100
Mittente: Alessio Soldano <asoldano@redhat.com>
A: resteasy-developers@lists.sourceforge.net


Il 10/01/2017 17:46, John Ulric ha scritto:
Hi all, 

I'm upgrading an application from RESTeasy v2 (2.2.1.GA) to v3 (3.0.19.Final). In v2, I was using the client proxy framework like this:

public interface MyClient {
  ClientResponse<MyPojo> myMethod();
}

with a call pattern like this:

ClientResponse<MyPojo> r = client.myMethod();
checkSuccessful(r); // 
MyPojo myPojo = r.getEntity();

With v3, things seem to be different.

The ClientResponse interface is deprecated, so I tried:

public interface MyClient {
  ClientResponse<MyPojo> myMethod0();
  MyPojo myMethod1();
  Response myMethod2();
}

Calling myMethod0 gives:

java.lang.ClassCastException: org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine$1 cannot be cast to org.jboss.resteasy.client.ClientResponse

Calling myMethod1 works and gives me a deserialized object, but it doesn't give me access to the HTTP status code, which I need.

Calling myMethod2 gives a response object, but response.getEntity() is always null.

I've probably got something wrong here, but I cannot figure it out and I haven't found any more information in the documentation.

Have you read http://docs.jboss.org/resteasy/docs/resteasy-upgrade-guide-en-US.pdf ?

Cheers
Alessio