Package org.restlet.ext.spring
Class SpringBeanFinder
- java.lang.Object
 - 
- org.restlet.Restlet
 - 
- org.restlet.resource.Finder
 - 
- org.restlet.ext.spring.SpringFinder
 - 
- org.restlet.ext.spring.SpringBeanFinder
 
 
 
 
 
- 
- All Implemented Interfaces:
 org.restlet.Uniform,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.context.ApplicationContextAware
public class SpringBeanFinder extends SpringFinder implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.ApplicationContextAware
An alternative toSpringFinderwhich uses Spring's BeanFactory mechanism to load a prototype bean by name. If both aBeanFactoryand aApplicationContextare provided, the bean will be looked up first in the application context and then in the bean factory. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.- Author:
 - Rhett Sutphin
 
 
- 
- 
Constructor Summary
Constructors Constructor Description SpringBeanFinder()Default constructor.SpringBeanFinder(org.restlet.routing.Router router, org.springframework.beans.factory.BeanFactory beanFactory, java.lang.String beanName)Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.restlet.resource.ServerResourcecreate()Creates a new instance of theServerResourceclass designated by the "targetClass" property.org.springframework.context.ApplicationContextgetApplicationContext()Returns the parent application context.org.springframework.beans.factory.BeanFactorygetBeanFactory()Returns the parent bean factory.java.lang.StringgetBeanName()Returns the bean name.org.restlet.ContextgetContext()org.restlet.routing.RoutergetRouter()Returns the associated router.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)Sets the parent application contextvoidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)Sets the parent bean factory.voidsetBeanName(java.lang.String beanName)Sets the bean name.voidsetRouter(org.restlet.routing.Router router)Sets the associated router.- 
Methods inherited from class org.restlet.ext.spring.SpringFinder
create, create 
- 
Methods inherited from class org.restlet.resource.Finder
createFinder, find, getTargetClass, handle, setTargetClass, toString 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
SpringBeanFinder
public SpringBeanFinder()
Default constructor. 
- 
SpringBeanFinder
public SpringBeanFinder(org.restlet.routing.Router router, org.springframework.beans.factory.BeanFactory beanFactory, java.lang.String beanName)Constructor.- Parameters:
 router- The associated router used to retrieve the context.beanFactory- The Spring bean factory.beanName- The bean name.
 
 - 
 
- 
Method Detail
- 
create
public org.restlet.resource.ServerResource create()
Description copied from class:SpringFinderCreates a new instance of theServerResourceclass designated by the "targetClass" property. This method is intended to be configured as a lookup method in Spring.- Overrides:
 createin classSpringFinder- Returns:
 - The created resource or null.
 
 
- 
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext()
Returns the parent application context.- Returns:
 - The parent context.
 
 
- 
getBeanFactory
public org.springframework.beans.factory.BeanFactory getBeanFactory()
Returns the parent bean factory.- Returns:
 - The parent bean factory.
 
 
- 
getBeanName
public java.lang.String getBeanName()
Returns the bean name.- Returns:
 - The bean name.
 
 
- 
getContext
public org.restlet.Context getContext()
- Overrides:
 getContextin classorg.restlet.Restlet
 
- 
getRouter
public org.restlet.routing.Router getRouter()
Returns the associated router.- Returns:
 - The associated router.
 
 
- 
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Sets the parent application context- Specified by:
 setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Parameters:
 applicationContext- The parent context.
 
- 
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Sets the parent bean factory.- Specified by:
 setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Parameters:
 beanFactory- The parent bean factory.
 
- 
setBeanName
public void setBeanName(java.lang.String beanName)
Sets the bean name.- Parameters:
 beanName- The bean name.
 
- 
setRouter
public void setRouter(org.restlet.routing.Router router)
Sets the associated router.- Parameters:
 router- The associated router.
 
 - 
 
 -