我已经放了web.xml,其中httpMethodFilter用于将post方法转换为put和delete,但是没有使用urlRewrite
调度员 org.springframework.web.servlet.DispatcherServlet 2 调度员 /应用/ *
<!-- For converting POST methods to PUT and DELETE methods-->
<filter>
<filter-name>httpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>httpMethodFilter</filter-name>
<servlet-name>dispatcher</servlet-name>
</filter-mapping>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
urlrewrite.xml
<urlrewrite default-match-type="wildcard">
<rule>
<from>/scripts/**</from>
<to last="true">/scripts/$1</to>
</rule>
<rule>
<from>/css/**</from>
<to last="true">/css/$1</to>
</rule>
<rule>
<from>/</from>
<to last="true">/app/index</to>
</rule>
<rule>
<from>/app/**</from>
<to last="true">/app/$1</to>
</rule>
<rule>
<from>/**</from>
<to>/app/$1</to>
</rule>
<outbound-rule>
<from>/app/**</from>
<to>/$1</to>
</outbound-rule> </urlrewrite>
控制器代码
@RequestMapping(method = RequestMethod.PUT, value = "/{articleId}/edit")
public String update(Article article,ModelMap model) {
//code here
}
请确定问题
答案 0 :(得分:0)
你应该添加url-pattern
<filter-mapping>
<filter-name>httpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>