@RequestMapping(method = RequestMethod.DELETE, value = "/delete/{id}") public void removeEarning(@PathVariable Long id, HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException { log.info("Delete earnings..."); boolean result = earningsService.removeEarning(id); response.setContentType(MediaType.APPLICATION_JSON_VALUE); new ObjectMapper().writeValue(response.getOutputStream(), result); }