users@jersey.java.net

Re: [Jersey] JSR 250 lifecycle mgmt/security annotations (@PostConstruct, @PreDestory) not working?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 06 Oct 2008 11:37:29 +0200

On Oct 3, 2008, at 4:41 PM, Alex Sherwin wrote:

> I was just experimenting with using @PostConstruct and @PreDestroy
> in my
> Resource classes, as specified in the JSR:
>
> "JAX-RS root resource classes and providers may also make use of the
> following JSR 250 lifecycle management and security annotations:
> @PostConstruct, @PreDestroy, @RunAs, @RolesAllowed, @PermitAll,
> @DenyAll and
> @DeclareRoles."
>
> I'm using Java EE 5 in Glassfish v2ur2 (SJSAS 9.1_02 actually), my
> WAR is
> contained inside of an EAR (don't think that should make any
> difference). I
> assume it's not the responsibility of Jersey to make these calls,
> but I'm
> wondering if maybe someone knows why they may not be being called?
>
>

You can use Jersey today with stateless session beans whose local or
remote interface is a root resource class. But it only works on
Glassfish. You do the following:

1) Annotate a local or remote interface with JAX-RS annotations; and

2) Register the interface in 1) e.g. use the package scanning support
and include the package where the
      interface in 1) resides i.e. the configuration is the same.

That is it. Jersey will look up an implementation of the registered
interface using JNDI. The look up mechanism is not portable and may or
may not work on other app servers.

Paul.

> Alex Sherwin
> alex.sherwin_at_acadiasoft.com
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>