[resteasy-dev] [Resteasy-developers] Upgrading a client proxy from v2 to v3

Alessio Soldano asoldano at redhat.com
Wed Jan 11 11:34:35 EST 2017


Please see Chapter 1.1, page 3, in particular the notes on 
Response.getEntity() vs Response.readEntity().
Basically, use response.readEntity() and response.getStatus().

Cheers
Alessio


Il 10/01/2017 17:55, John Ulric ha scritto:
> Yes, I have. Chapter 1.2 "Client Proxies" only gives one very simple 
> example with a method returning a String object.
>
> 2017-01-10 17:52 GMT+01:00 Alessio Soldano <asoldano at redhat.com 
> <mailto:asoldano at redhat.com>>:
>
>     Il 10/01/2017 17:46, John Ulric ha scritto:
>>     Hi all,
>>
>>     I'm upgrading an application from RESTeasy v2 (2.2.1.GA
>>     <http://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 ClientResponseinterface 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
>     <http://docs.jboss.org/resteasy/docs/resteasy-upgrade-guide-en-US.pdf>
>     ?
>
>     Cheers
>     Alessio
>
>     ------------------------------------------------------------------------------
>     Developer Access Program for Intel Xeon Phi Processors
>     Access to Intel Xeon Phi processor-based developer platforms.
>     With one year of Intel Parallel Studio XE.
>     Training and support from Colfax.
>     Order your platform today. http://sdm.link/xeonphi
>     _______________________________________________
>     Resteasy-developers mailing list
>     Resteasy-developers at lists.sourceforge.net
>     <mailto:Resteasy-developers at lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>     <https://lists.sourceforge.net/lists/listinfo/resteasy-developers>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/resteasy-dev/attachments/20170111/1373a0ea/attachment.html 


More information about the resteasy-dev mailing list