users@jax-rs-spec.java.net

[jax-rs-spec users] Re: Client proxy framework

From: Markus KARG <markus_at_headcrashing.eu>
Date: Tue, 20 Oct 2015 20:20:24 +0200

Bill,

-1 for WADL from me, too. It just mentioned it to say that what people often ask not always means that it is a good idea.

Yes, your proposal is sexy, no doubt. I actually love it. But the question is whether sexyness should be the main driver to decide which features to add to the spec?

-Markus

-----Original Message-----
From: Bill Burke [mailto:bburke_at_redhat.com]
Sent: Dienstag, 20. Oktober 2015 16:10
To: jsr370-experts_at_jax-rs-spec.java.net
Subject: Re: Client proxy framework

For multiple @Consumes, client just picks one based on registered MBWs.
  Usually not an issue unless people are sharing interfaces between the client and server.

We never did async, but it could be as simple as:

@GET
@Async
Future<MyData> get();

@GET
@Async
void get(InvocationCallback callback);


Again, I want to say that this feature has been available to our users for 6+ years. It is very easy to implement and simple to use for those that like that kind of style. IMO, this could be one of the "sexy"
features that entices users to upgrade to JAX-RS 2.1.


BTW -1000 code generation through WADL.


On 10/19/2015 3:59 PM, Sergey Beryozkin wrote:
> The minor problem with proxies is that if you have multiple Consumes
> there's no way to indicate that you want a particular Content-Type.
> Only using an implementation specific mechanism.
> Note each sub-resource locator on the interface is also a proxy.
> It is also not possible to control client-side async calls with
> proxies - but otherwise I agree with Bill - very popular feature.
>
> Sergey
>
> On 19/10/15 20:55, Markus KARG wrote:
>> This is an interesting feature, which shortens development time for
>> clients, and prevents hard-to-find typos. But I have two questions:
>>
>> (1) If I write a resource class that implements that interface, will
>> it inherit the annotations?
>>
>> (2) How does the framework handle MIME types?
>>
>> -Markus
>>
>> -----Original Message-----
>> From: Bill Burke [mailto:bburke_at_redhat.com]
>> Sent: Montag, 19. Oktober 2015 20:16
>> To: jsr370-experts_at_jax-rs-spec.java.net
>> Subject: Client proxy framework
>>
>> Resteasy's client proxy frameork has been a very popular feature and
>> in use for 6+ years. Basically it allows you to use JAX-RS
>> annotations on the client side to create a typed client proxy. i.e.
>>
>> @Path("/")
>> public interface MyService {
>>
>> @GET
>> MyData getData(@QueryParam("param") String param);
>>
>> @POST
>> Response postData(@FormParam("param") int param);
>>
>> }
>>
>> Then, you can take this interface and generate a client proxy:
>>
>> Client client = ClientBuilder.newClient(); MyService service =
>> client.proxy(MyService.class);
>>
>> MyData data = service.getData("value");
>>
>> There's other minor details involved, but do you get the gist?
>> Again, this is a very popular feature and IMO, a very natural
>> extension to the client api.
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>

--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com