users@jersey.java.net

Re: [Jersey] Jersey UriInfo /Jersey _at_Path

From: António Mota <amsmota_at_gmail.com>
Date: Tue, 18 Nov 2008 13:34:34 +0000

Here's some more thoughts.

> Jersey works correctly in conjunction with Spring injecting JAX-RS/Jersey
> things on to spring managed beans (works correctly for singleton, request.
> prototype as well as Aop proxied).

I found no way of doing that. I understand how Spring can inject it,
but who is responsible for instantiate the classes, like for example
the UriInfo? Do I have to use some kind of runtime environment
specific of Jersey? I did saw examples instantiating a Servlet, that
makes sense, but since I'm using my own Servlets, how can I do that?

>> And I can't use PathSegment because I'm really only writing the
>> service infrastructure, not the services themselves, and the services
>> are supposed to be "business" methods from a interface extracted from
>> a "business" class with just a bunch of rs annotations added, so I
>> can't be bound to anything rs-specific.
>>
>
> Do you mean to say that you have no control over the interfaces?

Yep, I don't have control of interfaces. The annotated interfaces are
injected in a Spring Integration Gateway that is handled by a generic
Resource I've implemented (and so each interface "becomes a resource
itself) , that is the responsible for matching http request to the
correct method of the interface, with the corresponding implementation
method being handled by the corresponding class that in turn was
declared as a "endpoint" handler of SI.


> The most important interface for RESTful Web services is HTTP. In this
> respect i don't think the interface/impl devision you is as important as it
> would be for the case when using RMI or SOAP. I don't understand enough
> about your use-case but i suspect you might be making it more difficult for
> yourself :-) You can easily create your own resource method that transforms
> information and then calls a business method.

Our point here is that the services are completely unaware of the
structure behind it, so a business class can be developed as normal,
as if it were to be called locally every time. Then, only the public
interface, after annotated with the corresponding paths, will be
accessed remotely thru the rest layer.

If i was to begin now, and knowing what I know now, it was better to
start with Jersey and then integrate Spring Integration below it, but
I did the opposite, I started with SI and integrated Jersey
afterwards. And there is no tine to go back. As usual.......