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: Mon, 14 Sep 2009 21:07:18 -0700 (PDT)
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 id="realEstateResource" class=""
  <property name="configuration" ref="freemarkerConfiguration" />
<bean id="realEstateResourceClass" factory-bean="realEstateResource" 
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.
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy