users@jersey.java.net

[Jersey] Re: Jersey without Annotations

From: Craig McClanahan <craigmcc_at_gmail.com>
Date: Thu, 2 Jan 2014 23:16:08 -0800

In other words, you are going to expect a third party class, not designed
to be a JAX-RS service class, to obey all the contracts? Okay ... glad
it's your system and not mine. I wouldn't touch such a thing ever.

If you really really want to do that, subclass the third party class with
one of your own that has JAX-RS annotations, and just delegates to the
third party class methods. But don't come crying here when the whole thing
falls apart because you are trying to assign responsibilities to the third
party class that it did not necessarily have any intention of supporting.

On the other hand, leveraging third party business logic, and wrapping it
with REST endpoints that obey real JAX-RS contracts, is so simple I'm
amazed that you wouldn't choose that path instead. You might even think
about adding some hypermedia links to your REST representations to obey the
HATEOS constraint :-).

Craig


On Thu, Jan 2, 2014 at 10:42 PM, buko <buko_at_chiubarobot.com> wrote:

> As somebody who recently switched from RestEasy to Jersey I would
> disagree.
>
> Though it's not clear why you would need to extensive Jaxrs annotations.
> Are there use cases where you have a third party class that you don't have
> source for but you want to annotate to expose as a web service?
> On Jan 3, 2014 1:38 AM, "cowwoc" <cowwoc_at_bbs.darktech.org> wrote:
>
>> Slightly off-topic, but why do people care so much about JAX-RS
>> portability? I get the feeling that users switch JAX-RS providers almost as
>> often as they switch databases... which is almost never.
>>
>> Gili
>>
>> On 03/01/2014 1:13 AM, Craig McClanahan wrote:
>>
>> Inquiring minds would like to know ... why in the world would you want to
>> tie yourself so closely to the internal APIs of one particular JAX-RS
>> implementation. Indeed, why bother with JAX-RS if you don't like the
>> annotations -- that is a key value add for developer productivity.
>>
>> Craig McClanahan
>>
>>
>> On Thu, Jan 2, 2014 at 6:53 PM, Imran Bashir <imran_1981_at_aol.com> wrote:
>>
>>> Hi Bill,
>>>
>>> Thank you for your e-mail. Could you please provide me some example that
>>> would be great.
>>>
>>> Sincerely
>>> Imran
>>> Sent from AOL Mobile Mail
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Bill O'Neil <oneil5045_at_gmail.com>
>>> To: users <users_at_jersey.java.net>
>>> Sent: Thu, Jan 2, 2014 03:35 PM
>>> Subject: [Jersey] Re: Jersey without Annotations
>>>
>>>
>>> You can bind Resources programmatically without using annotations.
>>> https://jersey.java.net/documentation/latest/user-guide.html#d0e2435
>>>
>>> If you want to work directly with the Request, Response objects you
>>> should be able to do this. It will be a little more trouble to get cookie,
>>> header, path, and query parameters. It should be doable though.
>>>
>>>
>>> On Thu, Jan 2, 2014 at 4:30 PM, Imran Bashir <imran_1981_at_aol.com> wrote:
>>>
>>> Hi Everyone,
>>> I wanted to know can I develop a rest web service using Jersey without
>>> Annotation.
>>> Sincerely
>>> Imran
>>>
>>>
>>>
>>
>>