[jboss-user] [EJB 3.0 Users] - Re: Lookup for a session bean if only the interface is given

Juergen.Zimmermann do-not-reply at jboss.com
Fri Nov 13 12:48:51 EST 2009


I'm trying to integrate Jersey with JBossAS.  Jersey is an implementation of JAX-RS, and we want to compare RESTEasy and Jersey.

However, Jersey resolves @EJB only for Glassfish. Therefore, I have to implement a class as follows:


  | import java.lang.reflect.Type;
  | ...
  | @Provider
  | public class EJBProvider implements InjectableProvider<EJB, Type> {
  | 	...
  | 	public Injectable<Object> getInjectable(ComponentContext componentCtx, EJB ejb, Type type) {
  | 		if (!(type instanceof Class<?>))
  | 			return null;
  | 		Class<?> clazz = (Class<?>) type;
  | 		String interfaceName = clazz.getSimpleName();
  | 		...
  | 		Object obj = ...; // the session bean being referenced: How to get it?
  | 
  | 		return new Injectable<Object>() {
  | 			public Object getValue() {
  | 				return obj;
  | 			}
  | 		};
  | 	}

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265604#4265604

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265604



More information about the jboss-user mailing list