@RequestMapping(value = "/saveprev_getnext", method = RequestMethod.POST) @ResponseBody @JsonRawValue String getNextAndSavePrevious( @RequestHeader(value = "Authorization") String token, @RequestBody String answer) { long testId = tokenProcessor.decodeAndCheckToken(token); String res = null; if (testId != -1) { if (!personal.testIsPassed(testId)) { if (answer != null && !answer.equalsIgnoreCase("")) { personal.setAnswer(testId, answer); } res = personal.getNextQuestion(testId); if (res == null) { res = "{\"error\":\"test is already passed\",\"isPassed\":true}"; } } else { res = "{\"error\":\"test is already passed\",\"isPassed\":true}"; } } else { res = "error - wrong token"; } return res; }
@RequestMapping(value = "/save_image", method = RequestMethod.POST) @ResponseBody @JsonRawValue String saveImage( @RequestHeader(value = "Authorization") String token, @RequestBody String image) { long testId = tokenProcessor.decodeAndCheckToken(token); if (testId != -1) { personal.saveImage(testId, image); } return ""; }