I am getting a Request method \'PUT\' not supported
error on hitting a PUT method on a restful API to upload a file.
Following is the
To enable the PUT verb you have to add an interceptor that allows that method in the response header.
Something like that:
public class SasAllowOriginInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler)
throws Exception {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods",
"GET, POST, PUT, DELETE, OPTIONS");
return true;
}
}
I don't know how to add an interceptor using spring boot though, and I would be intersted in knowing it :)