Earthly Powers
- All
- Fast Infoset
- General
- Java
- REST
Jersey, Glassfish, and EJBs as root resources
Jersey supports EJB 3.0 beans as root resources as follows:
- Annotate a local or remote interface with @Path and annotate methods as appropriate; and
- Ensure that the local or remote interface in 1) is registered by file/directory or package scanning.
The registration mechanism in 2) is no different for registering non-EJBs. The caveat: it currently only works with Glassfish, which supports JNDI lookup of an EJB reference using the fulling qualified class name of the local or remote interface.
The JSR 311 expert group is currently considering approaches to integrate JAX-RS with EJB 3.1, which should present some nice improvements, namely EJBs bundled in the war and EJBs with no interfaces. I have high hopes we can retain the current ease of use registration aspects with JAX-RS as presented here and then it should be really simple to use EJBs as POJOs in the web tier directly serving HTTP requests.
There are already some EJB 3.1 features ready in Glassfish Prelude, as highlighted by Ken, with update centre instructions from Mahesh. Now i need to find the time to experiment...
Posted at 11:23AM Dec 02, 2008 by Paul Sandoz in REST | Comments[0]