dev@jsr311.java.net

EJB or MDB as a Resource implementation

From: Ryan McDonough <ryan_at_damnhandy.com>
Date: Tue, 9 Oct 2007 17:40:44 -0400

One of the goals I had been working on with RESTEasy was the ability to
expose an EJB 3 Session Bean or an MDB as a RESTful end point. I have some
fairly dated pages here:

http://resteasy.damnhandy.com/session-bean-service.html

And here:

http://resteasy.damnhandy.com/message-driven-bean-service.html

These pages describe an early idea I had of how it might be implemented. For
the most part, much of it worked and the MDB portion was extremely handy.
One thing I had not fully worked out was how to handle resource injection of
things like headers, request contexts, etc. I had been working with JBoss
Seam to achieve some of this but never got around to finishing it. Since
Paul brought up the topic of the JSR-299 (aka Web Beans), it reignited the
idea. Being able to do something like this would make the development
experience a bit more JAX-WS-like in that you could simply add a few more
annotations to an EJB and have it exposed as both SOAP and REST style web
services.

Since I got involved a bit late in the game, I haven't fully grasped the
design decision to have the resource class created and destroyed on each
request, so there maybe something very important I am missing here. However,
even this type of thing is not something the EG is interested in pursuing,
would it be possible to consider a mechanism whereby another type of
component could serve as a Resource? This way, it is left up to the
implementor to provide the support but standard annotations would still be
valid. Thoughts?

Ryan-

-- 
Ryan J. McDonough
http://www.damnhandy.com