My dilemma involves an ajax post that sends certain values from a URL:
var sendUrl = url + ',' + testId + ',' + questionId + ',' + questionRevision + ',' + result;
var ajaxData = {
type: "POST",
contentType : 'application/json; charset=utf-8',
dataType : 'json',
data: requestData,
url: sendUrl,
headers: headersData,
};
and links them with @PathVariable in the following manner:
@RequestMapping(value="/answer,{testId},{qid},{qrev},{qres}", method = RequestMethod.POST)
public @ResponseBody String answer(HttpServletRequest request,
@RequestBody List<NokDataDTO> nokInfoDtos ,
@PathVariable("testId") Long testId,
@PathVariable("qid") Long qid,
@PathVariable("qrev") Integer qrev,
@PathVariable("qres") Integer qres)
In this scenario, I am wondering if there is a way to pass an image file using @PathVariable. Although I can fetch the uploaded file from JavaScript like this:
var fileVal=document.getElementById("fileLoader").files[0];
I am unable to figure out how to bind it through RequestMapping.