users@jersey.java.net

_at_PostConstruct and _at_PreDestroy supported

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 05 Nov 2008 11:23:08 +0100

Hi,

I have improved the life-cycle managed of Jersey managed stuff so that:

1) PerRequest is truly per-request meaning one instance is created per
request (previously it was per instance).
     Thus using ResourceContext more than once for a per-request class
will get the same instance (sub-
     resources can then get the instance of a super resource).

2) @PostConstruct and @PreDestroy are supported for resource classes
and providers. All life-cycles,
     per-request, per-session and singleton are supported for resource
classes.


Note that a resource class instance created by the application and
returned by a sub-resource locator method will not be managed by
Jersey. This is because the life-cycle is determined by the
application and is unknown to Jersey. To support such a case you need
to either:

  - return the class; or

  - use ResourceContext to get an instance that is returned.

There may be other easer ways to do this. Any ideas?

Paul.