Spring mvc Spring MVC-警告[PageNotFound]在名为';弹簧座';
我正在JBoss应用服务器上运行SpringMVC 文件:jboss-web.xml:Spring mvc Spring MVC-警告[PageNotFound]在名为';弹簧座';,spring-mvc,jboss,controller,Spring Mvc,Jboss,Controller,我正在JBoss应用服务器上运行SpringMVC 文件:jboss-web.xml: <jboss-web> <context-root>/foo/bar/baz</context-root> </jboss-web> 我正在尝试用这种方法处理请求 当Spring加载到JBoss中时,我看到以下内容: [ " 我尝试访问:,我看到的是: 警告[PageNotFound]在名为“spring rest”的
<jboss-web>
<context-root>/foo/bar/baz</context-root>
</jboss-web>
我正在尝试用这种方法处理请求
当Spring加载到JBoss中时,我看到以下内容:
[
"
我尝试访问:,我看到的是:
警告[PageNotFound]在名为“spring rest”的DispatcherServlet中找不到URI为[/foo/bar/baz/rest]的HTTP请求的映射
但当我在Java中将值更改为“/”from“/rest/”时:
@RequestMapping(value="/*", method = RequestMethod.POST)
然后它就可以正常工作了。我如何解决这个问题
spring-rest-servlet.xml:
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="alwaysUseFullPath" value="true"/>
</bean>
<bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="alwaysUseFullPath" value = "true" />
</bean>
如果您真的想让
/rest
和/rest/*
通过单一方法处理,请使用:
@RequestMapping(value={ "/rest", "/rest/*" }, method = RequestMethod.POST)
与:
它可以工作,因为它接受/foo/bar/baz
之后的所有内容,而不仅仅是/rest
@RequestMapping(value="/*", method = RequestMethod.POST)
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="alwaysUseFullPath" value="true"/>
</bean>
<bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="alwaysUseFullPath" value = "true" />
</bean>
@RequestMapping(value={ "/rest", "/rest/*" }, method = RequestMethod.POST)
@RequestMapping(value="/*", method = RequestMethod.POST)