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 java.lang.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 java.lang.annotation.Annotation applicationScopedLiteral
           
static java.lang.annotation.Annotation requestScopedLiteral
           
 
Constructor Summary
ResteasyCdiExtension()
           
 
Method Summary
 java.util.Map<java.lang.Class<?>,java.lang.Class<?>> getSessionBeanInterface()
           
<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, java.lang.annotation.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 java.lang.annotation.Annotation requestScopedLiteral

applicationScopedLiteral

public static final java.lang.annotation.Annotation applicationScopedLiteral
Constructor Detail

ResteasyCdiExtension

public ResteasyCdiExtension()
Method Detail

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,
                                                                             java.lang.annotation.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 java.util.Map<java.lang.Class<?>,java.lang.Class<?>> getSessionBeanInterface()


Copyright © 2010. All Rights Reserved.