使用Restlet和SpringServerServlet接收404错误
我刚从Restlet开始,使用的是2.0-M3版本。我正在尝试在web应用程序中使用Spring。当我试图在我的应用程序中访问url/hello时,我收到一个404错误。以下是我的代码部分: web.xml使用Restlet和SpringServerServlet接收404错误,spring,restlet,Spring,Restlet,我刚从Restlet开始,使用的是2.0-M3版本。我正在尝试在web应用程序中使用Spring。当我试图在我的应用程序中访问url/hello时,我收到一个404错误。以下是我的代码部分: web.xml <servlet> <servlet-name>rest</servlet-name> <servlet-class> org.restlet.ext.spring.SpringServerSer
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>
org.restlet.ext.spring.SpringServerServlet
</servlet-class>
<init-param>
<param-name>org.restlet.component</param-name>
<param-value>helloComponent</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
applicationContext.xml
<bean id="helloComponent" class="org.restlet.ext.spring.SpringComponent">
<property name="defaultTarget" ref="helloAppliction" />
</bean>
<bean id="helloAppliction" class="MyApplication">
<property name="root" ref="router" />
</bean>
<!-- Define the router -->
<bean name="router" class="org.restlet.ext.spring.SpringBeanRouter"/>
<!-- Define all the routes -->
<bean name="/hello" id="helloResource" class="MyServerResource" scope="prototype" autowire="byName" />
有人能告诉我你有什么不对劲吗
谢谢!
Eric我想你也在Restlet的讨论板上发布了吗?我的回答和我在那里做的一样 您没有将“/hello”路径连接到路由器。您的路由器没有路由,因此将始终提供404
<bean id="helloComponent" class="org.restlet.ext.spring.SpringComponent">
<property name="defaultTarget" ref="helloAppliction" />
</bean>
<bean id="helloAppliction" class="MyApplication">
<property name="root" ref="router" />
</bean>
<!-- Define the router -->
<bean name="router" class="org.restlet.ext.spring.SpringBeanRouter"/>
<!-- Define all the routes -->
<bean name="/hello" id="helloResource" class="MyServerResource" scope="prototype" autowire="byName" />
Oct 12, 2013 11:34:59 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2013-10-12 23:34:59 127.0.0.1 - 127.0.0.1 8080 GET /mywebapp/hello - 404 330 - 1 http:
//localhost:8080 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 -