tags:

views:

257

answers:

2

My initial look at Jersey suggested this was a nice framework that made it easy to create RESTful Java APIs.

Unfortunately, since making the decision to use it (together with Grizzly), I've found it to be very poorly documented, consequently it is very hard to perform common tasks (that I'm sure are very easy once you know how).

Anyway, griping over (sorry, but I've wasted a lot of time on this and I'm frustrated), my question:

How do I inject objects into resources? I know I need to use Injectable and related classes, but after reading the Javadocs, it is still unclear how to do this.

My use-case is really simple, I have objects that the resources need to access, and I'd really rather avoid using static fields to expose the objects to the resources. Its hard to imagine that anyone has built a Jersey app without doing this, yet I'm having a really hard time finding out how.

Can anyone point me to some simple examples of how to do this?

PS. I'd prefer not to use Guice, that seems like overkill for my needs.

A: 

I'm not sure what you mean by "resources".

If you're talking about the @Resource annotation, it seems that you have to do the heavy lifting yourself.

Chase Seibert
A: 

I eventually gave up on Jersey and switched (back) to Restlet. Jersey is poorly documented, and convoluted :-(

sanity