Custom Search

[Top] [All Lists]

RE: No target class was defined for this finder ...

Subject: RE: No target class was defined for this finder ...
Date: Fri, 25 Sep 2009 11:07:03 +0200
Hi guys,
As reported in issue #892, this should now work fine in SVN trunk. If you could 
do additional testing that would be welcome.
Best regards,
Jerome Louvel
Restlet ~ Founder and Lead developer ~
Noelios Technologies ~ Co-founder ~
-----Message d'origine-----
De : Rhett Sutphin 
[mailto:[email protected]] 
Envoyà : vendredi 18 septembre 2009 18:50
à : code-s0N/[email protected]
Objet : Re: No target class was defined for this finder ...
Hi Cheng,
On Sep 14, 2009, at 11:07 PM, Cheng Lee wrote:
> I'm using org.restlet.ext.spriâng 2.0-M3 and I'm seeing the same  
> problem.
> To solve "No target class was defined for this finder ..." I had to  
> add an additional property "targetClass" in my spring config and add  
> a factory bean to instantiate a Class:
> <entry key="/realEstate">
>  <bean class="org.restlet.ext.spring.SpringFinder">
>    <lookup-method name="createResource" bean="realEstateResource" />
>    <property name="targetClass" ref="realEstateResourceClass"></ 
> property>
>  </bean>
> </entry>
> <bean id="realEstateResource" class=""
>    scope="prototype">
>  <property name="configuration" ref="freemarkerConfiguration" />
> </bean>
> <bean id="realEstateResourceClass" factory-bean="realEstateResource"  
> factory-method="getClass"/>
> This should make your problem go away since it will instantiate the  
> Resource correctly. But it's still not using Spring context so read  
> on.
> I've seen that the SpringFinder is not retrieving the bean  
> "realEstateResource" from the spring context but rather  
> instantiating "targetClass" using newInstance() and of course not  
> enjoying any of the dependencies injection.
> The reason why it's not working is because I'm extending  
> ServerResource instead of Resource. Now, the new ServerResource does  
> not extend Handler so it will be false in  
> org.restlet.resource.Finder line 450:
> if (Handler.class.isAssignableFrom((Class<? extends Handler>)  
> getTargetClass())) {
> which in turn calls "find(request, response)" instead of  
> "findTarget(request, response)". The consequence is that the lookup- 
> method we declared above (createResource) is never called.
> I think I can contribute a fix for this.
This issue is being tracked as #892:
That's the place to contribute a fix if you'd care to.  Be sure to  
read the contribution guidelines first:
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy