I am trying to delete a resource on my server and would like to do this via an ordinary link on my webpage.
I understand that when clicking on a link we cannot send a DELETE request to the server so I tried working around this with
<form id="aux_form" action="environment/"> <input type="hidden" name="_method" value="delete"> <input type="hidden" name="id" value="${env.id}"> </form> and my Spring controller methods is annotated with
@RequestMapping(value = "/environment/", method = RequestMethod.DELETE) However, I receive the error message "The specified HTTP method is not allowed for the requested resource (Request method 'GET' not supported)." so I know that my controller method is not called and the delete request is not properly mapped.
Would appreciate if anyone could tell me how to properly send this delete request.
Thanks :)
HiddenHttpMethodFilter, I have added that information in my answer