I want post a formdata where somme value/files can be null/empty. I tried to modify every parameters but when i resolve the 415 i get a 405 error.
Here is my controller function
@RequestMapping(value = "/cart/post", method = RequestMethod.POST)
public @ResponseBody String addToCart(@RequestBody
ConfigurationForm configurationForm, BindingResult bindingResult)
throws CMSItemNotFoundException{
Here is my AJAX request
$('#popin_overlay_configuration').on('submit', '#configure-product-
form', function (e) {
e.preventDefault();
var productCode = configuredCode;
var formData = new FormData();
// Code where i fill my formdata
$.ajax({
url: "cart/post",
type: 'POST',
data: formData,
cache: false,
processData: false,
contentType: false,
success: function(data) {
$('#popin_overlay_configuration').hide();
}
});
})
Here is my ConfigurationForm
public class ConfigurationForm
{
private String date;
private String lieuDePrestation;
private String pointDeContact;
private String commentaire;
private String transport;
private List<MultipartFile> PJFacultative;
private String referenceS;
private String referenceL;
private MultipartFile PJObligatoire;
//all the getters and setters are set
}