Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring 4.3.3 - ParameterizableViewController POST method not more supported

After upgrading to Spring 4.3.3.RELEASE i get the error:

Request method 'POST' not supported

My application is a basic template and the home view is rendered via

<mvc:view-controller path="/" view-name="home.view"/>

It works fine on Spring 4.2.8.

Any hint to solve the problem?

like image 985
Nazca Group Avatar asked Sep 06 '25 03:09

Nazca Group


1 Answers

We ran into the same problem. It turns out that, at some point, the ParameterizableViewController was changed to only support GET and HEAD requests.

We resolved this by replacing the definition with something like this:

<bean id="homeController" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
    <property name="supportedMethods" value="GET,POST,PUT,DELETE" />
    <property name="viewName" value="home.view" />
</bean>

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <map>
            <entry key="/" value-ref="homeController"/>
        </map>
    </property>
</bean>

Essentially, this allows you to create a ParameterizableViewController with whatever supported HTTP methods you wish. The second bean creates the mapping so that the path "/" resolves to the defined controller.

like image 92
Brian Mouallem Avatar answered Sep 07 '25 16:09

Brian Mouallem