PlanetJava
Custom Search

java-restlet-devel
[Top] [All Lists]

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

Subject: Re: No target class was defined for this finder ...
Date: Fri, 18 Sep 2009 11:50:21 -0500
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="com.company.RealEstateResource"
>    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:
http://restlet.tigris.org/issues/show_bug.cgi?id=892
That's the place to contribute a fix if you'd care to.  Be sure to  
read the contribution guidelines first:
http://www.restlet.org/community/contribute
Rhett
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=7458&dsMessageId=2396523
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy