views:

37

answers:

1

i have put web.xml in which httpMethodFilter is used for converting post methods to put and delete,but not working with urlRewrite

dispatcher org.springframework.web.servlet.DispatcherServlet 2 dispatcher /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>

controller code

   @RequestMapping(method = RequestMethod.PUT, value = "/{articleId}/edit")
    public String update(Article article,ModelMap model) {
//code here 
}

please identify the problem

A: 

You should add url-pattern

 <filter-mapping>
        <filter-name>httpMethodFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
atomsfat