Did you get the error below when trying to post a form?
org.springframework.web.client.HttpClientErrorException: 405 Method Not Allowed
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:614)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:570)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:530)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:357)
...
Here's how I fixed it:
open the controller class and go to the method that handles the request:
@RestController
@RequestMapping("/my-mapping")
public class MyController
@RequestMapping(value = "/commands/MyCommand", method = RequestMethod.PUT)
public void invoke(@RequestBody MyCommand command) {
...
change the method from RequestMethod.PUT (or whatever the value is) to RequestMethod.POST.
Restart the server and post the form again. That should fix the error
I am also facing the similar issue, why we have to change the method from PUT to POST, I suppose to use PUT only.
ReplyDeletePlayland Resort and Casino - Mapyro
ReplyDeleteView all the other casino hotels 광주광역 출장안마 in Washington, D.C. · Borgata Hotel Casino & Spa is a casino 안양 출장안마 hotel 전라남도 출장샵 in Atlantic City, 세종특별자치 출장마사지 NJ 구리 출장샵 with 2 restaurants, a nightclub,