dushkindigital / marketmap

New, clean repo for Shekhar
2 stars 0 forks source link

Update LiberecoListing does not support image upload #20

Closed shekhargulati closed 12 years ago

shekhargulati commented 12 years ago

The issue has been fixed but not in the way I would have like. The problem is the way Spring MVC support REST put and delete methods. In HTML forms there is no option to set method as PUT or DELETE. Only two methods supported are get and post. So, what spring does is that it creates a hidden field _method and put the value "PUT" or "DELETE" in it. On the server side there is a filter which reads the request parameter and map it to the correct method. Image uploads works using multi-part form data. Now when Spring CommonMultipartResolver reads the request data it somehow does not read the hidden parameter. This results in PUT method not called. The fix that I have applied is to change the mapping /libercolisting/update and use POST method. This fixes the problem. I will try some more time googling out the solution or ask on stackoverflow. But for now it is fixed.