Search code examples
javaandroidjax-rsrestlet

Restlet Client using JAX-RS annotated resources


I am writing a restlet client that will invoke some Resteasy coded rest services (cannot change the server code, hence cannot use the Restlet way of annotating resources). Resource Interface is using JAX-RS annotations and have more than one @POST method (one of the biggest problems of Restlet when dealing with this).

I was trying to do my implementaion this way: IAppLoginResource resource = JaxRsClientResource.createJaxRsClient("http://localhost:9090/rest", IAppLoginResource.class); final GetLoginAppInfoResponse response = resource.getLoginAppInfo( getLoginAppInfoRequest );

The problem is that the request by default is GET, I didn't find a way to specify the request method like when using ClientResource (which I can't use because I need to deal with JaxbRepresentation and Jaxb problems).

Any sample/snippet of code that implement a Restlet client using JAX-RS annotated resources?

Any ideas?

Thanks,


Solution

  • I've entered an issue for this topic: https://github.com/restlet/restlet-framework-java/issues/1081

    I've tested a sample application based on your code, and it works properly using the current 2.3 branch (future 2.3.3). I wonder if the fix for this issue https://github.com/restlet/restlet-framework-java/issues/1072 helps.

    Regarding the documentation, I 'll complete the current page (http://restlet.com/technical-resources/restlet-framework/guide/2.3/extensions/jaxrs), cf this issue: https://github.com/restlet/restlet-framework-java/issues/1084. You can also have a look at the org.restlet.test project, especially in this package https://github.com/restlet/restlet-framework-java/tree/2.3/modules/org.restlet.test/src/org/restlet/test/ext/jaxrs.