org.jboss.resteasy.cdi
Class ResteasyCdiExtension

java.lang.Object
  extended by org.jboss.resteasy.cdi.ResteasyCdiExtension
All Implemented Interfaces:
javax.enterprise.inject.spi.Extension

public class ResteasyCdiExtension
extends Object
implements javax.enterprise.inject.spi.Extension

This Extension handles default scopes for discovered JAX-RS components. It also observes ProcessInjectionTarget event and wraps InjectionTargets representing JAX-RS components within JaxrsInjectionTarget. Furthermore, it builds the sessionBeanInterface map which maps Session Bean classes to a local interface. This map is used in CdiInjectorFactory during lookup of Sesion Bean JAX-RS components.

Author:
Jozef Hartinger

Field Summary
static Annotation applicationScopedLiteral
           
static Annotation requestScopedLiteral
           
 
Constructor Summary
ResteasyCdiExtension()
           
 
Method Summary
 Map<Class<?>,Type> getSessionBeanInterface()
           
 void observeBeforeBeanDiscovery(javax.enterprise.inject.spi.BeforeBeanDiscovery event, javax.enterprise.inject.spi.BeanManager beanManager)
          Obtain BeanManager reference for future use.
<T> void
observeInjectionTarget(javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)
          Wrap InjectionTarget of JAX-RS components within JaxrsInjectionTarget which takes care of JAX-RS property injection.
<T> void
observeResources(javax.enterprise.inject.spi.ProcessAnnotatedType<T> event)
          Set a default scope for each CDI bean which is a JAX-RS Resource, Provider or Application subclass.
<T> void
observeSessionBeans(javax.enterprise.inject.spi.ProcessSessionBean<T> event)
          Observes ProcessSessionBean events and creates a (Bean class -> Local interface) map for Session beans with local interfaces.
protected
<T> javax.enterprise.inject.spi.AnnotatedType<T>
wrapAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<T> type, Annotation scope)
           
protected
<T> javax.enterprise.inject.spi.InjectionTarget<T>
wrapInjectionTarget(javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requestScopedLiteral

public static final Annotation requestScopedLiteral

applicationScopedLiteral

public static final Annotation applicationScopedLiteral
Constructor Detail

ResteasyCdiExtension

public ResteasyCdiExtension()
Method Detail

observeBeforeBeanDiscovery

public void observeBeforeBeanDiscovery(@Observes
                                       javax.enterprise.inject.spi.BeforeBeanDiscovery event,
                                       javax.enterprise.inject.spi.BeanManager beanManager)
Obtain BeanManager reference for future use.


observeResources

public <T> void observeResources(@Observes
                                 javax.enterprise.inject.spi.ProcessAnnotatedType<T> event)
Set a default scope for each CDI bean which is a JAX-RS Resource, Provider or Application subclass.


wrapAnnotatedType

protected <T> javax.enterprise.inject.spi.AnnotatedType<T> wrapAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<T> type,
                                                                             Annotation scope)

observeInjectionTarget

public <T> void observeInjectionTarget(@Observes
                                       javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)
Wrap InjectionTarget of JAX-RS components within JaxrsInjectionTarget which takes care of JAX-RS property injection.


wrapInjectionTarget

protected <T> javax.enterprise.inject.spi.InjectionTarget<T> wrapInjectionTarget(javax.enterprise.inject.spi.ProcessInjectionTarget<T> event)

observeSessionBeans

public <T> void observeSessionBeans(@Observes
                                    javax.enterprise.inject.spi.ProcessSessionBean<T> event)
Observes ProcessSessionBean events and creates a (Bean class -> Local interface) map for Session beans with local interfaces. This map is necessary since RESTEasy identifies a bean class as JAX-RS components while CDI requires a local interface to be used for lookup.


getSessionBeanInterface

public Map<Class<?>,Type> getSessionBeanInterface()


Copyright © 2011. All Rights Reserved.