Hi Jason,

The Spring extension wasn't supporting the new resource API (ServerResource)
in 2.0 M3. I have just fixed this today, so I suggest that you try again
when a new 2.0 snapshot is pushed. Note that the lookup method will be
create() instead of createResource() which was for the now deprecated
Resource class.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Jason Jho [mailto:[email protected]] 
Envoyé : lundi 8 juin 2009 23:20
À : [email protected]
Objet : Using RestletFrameworkServlet

Hi,

With the latest development milestone3 download, I can run the firstResource
demo just fine by using standalone client and server classes.

However, moving to Spring MVC, I am having some trouble getting things to
work.  As documented, I added a new servlet definition as follows:

 <!-- Restlet adapter -->
    <servlet>
        <servlet-name>api</servlet-name>
        <servlet-class>
             org.restlet.ext.spring.RestletFrameworkServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Catch all request URIs starting with  prefix /rest-->
    <servlet-mapping>
        <servlet-name>api</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>


I have a corresponding api-servlet.xml file that has the following:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

        <bean id="root" class="org.restlet.ext.spring.SpringRouter">
        <property name="attachments">
            <map>
                <entry key="/users/{username}">
                                        <bean
class="org.restlet.ext.spring.SpringFinder">
                                                <lookup-method
name="createResource"
                                                        bean="userResource"
/>
                                        </bean>
                                </entry>
            </map>
        </property>
    </bean>

    <bean id="userResource" class="com.test.api.UserResource"
scope="prototype" >
    </bean>

</beans>


The UserResource class is the most basic class with a toString() method that
returns "HelloWorld" and is annotated via @Get.


When I access the URL myapp/api/users/bob, I get no response and the
following error in the console:


A response with a 200 (Ok) status should have an entity. Make sure that
resource "http://localhost:8080/myapp/api/users/bob"; returns one or sets the
status to 204 (No content).

Has anyone else run into this?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23604
71

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2360918

Reply via email to