java - error 500 when updating data -
i want update atributte ad_stat table name advert error:
500 not parse multipart servlet request; nested exception javax.servlet.servletexception:org.apache.tomcat.util.http.fileupload.fileuploadbase$invalidcontenttypeexception: request doesn't contain multipart/form-data or multipart/mixed stream, content type header null"
here code update data
@apioperation(value = "deactivead", nickname = "deactive ad") @requestmapping(method = requestmethod.get, path = "ads/deactive", produces = "application/json") @apiresponses(value = { @apiresponse(code = 200, message = "success"), @apiresponse(code = 401, message = "unauthorized"), @apiresponse(code = 403, message = "forbidden"), @apiresponse(code = 404, message = "not found"), @apiresponse(code = 500, message = "failure") }) public response deactivead(@requestpart(name = "adsid", required = true) int ad_id){ response response = new response(); dbhandler db = new dbhandler(); if(db.getresult() == 0){ try{ string sql = "update advert set ad_stat = false ad_id = "+ad_id+";"; if(!db.execute(sql)) { response.setstatus("0"); }else{ response.setstatus("3"); } db.closestatement(); db.closeconnection(); }catch(sqlexception e) { response.setstatus("1"); try{ db.closeconnection(); db.closestatement(); }catch(sqlexception e1) { } } }else{ response.setstatus(string.valueof(db.getresult())); } return response; }
the data type ad_stat boolean, , try false it
change
@requestmapping(method = requestmethod.get, path = "ads/deactive", produces = "application/json")
to
@requestmapping(method = requestmethod.post, path = "ads/deactive", produces = "application/json",content-type="multipart/formdata")
Comments
Post a Comment