On Mar 31, 2009, at 7:45 PM, Patrick Sansoucy wrote:
>> I wanted to go with the least custom code possible follow current
>> Jersey API's as much as possible. Anyway, is this something planned
>> within the Jersey API ?
>
>
> Not yet, if you would like this can please log an issue so we can
> track it.
>
> Done, Issue 253
>
Thanks.
>
> Would the plain JavaBean approach (like i prototyped) be sufficient
> for your purposes?
>
> Think so, if I understand properly, I would just need to do a post
> on the web resource to get the result ?
Yes. The post method with one parameter that is the class of the
instance you want returned.
> Also, could the following be done with the prototype you mentioned ?
> I would like to be able to avoid creating resources for each use.
> BeanUri bu = new BeanUri();
> // set state on bu
> Client c = .... c.resource(bu);
> // post c
>
> // set another state on bu
> // post c
>
No. Every time you change the URI you need to create a new WebResource.
WebResource is designed to be immutable so it is thread safe and a
reference can be passed around.
>
>
>
>
>
> I am a bit reluctant to reuse @Path on bean because it is being with
> different semantics i.e. what is annotated is not a resource class.
> However, some different annotations could be used.
>
> No problem with that, I agree that confusion may arise from this ...
> The only point I saw of re-using the annotation was if one could
> find a way to build a single pojo for server AND client so it could
> be used like an API. But I doubt this would simple and achievable in
> a short to mid term.
I would be careful of assuming that the client can share server-side
artifacts. It might cause issues when you need to evolve either.
Paul.