我已经将其中的httpMethodFilter用于将postMethod转换为放置和删除的web.xml放置了,但是无法使用urlRewrite
调度员
org.springframework.web.servlet.DispatcherServlet
2
调度员
/ app / *
<!-- 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
}
请找出问题所在
最佳答案
您应该添加url-pattern
<filter-mapping>
<filter-name>httpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>