@RequestMapping(method = RequestMethod.POST) @ResponseBody public String create( @RequestParam MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException { ClobDatatypeStorage clobData = new ClobDatatypeStorage(); String encoding = request.getHeader("Content-Encoding"); clobData.setValue(IOUtils.toString(file.getInputStream(), encoding)); clobData = datatypeService.saveClobDatatypeStorage(clobData); response.setStatus(HttpServletResponse.SC_CREATED); return clobData.getUuid(); }
@RequestMapping(method = RequestMethod.GET, value = "/{uuid}") public void retrieve( @PathVariable("uuid") String uuid, HttpServletRequest request, HttpServletResponse response) throws Exception { ClobDatatypeStorage clobData = datatypeService.getClobDatatypeStorageByUuid(uuid); PrintWriter writer = null; try { writer = response.getWriter(); writer.print(clobData.getValue()); writer.flush(); } finally { if (writer != null) { writer.close(); } } }