Welcome to
On Feet Nation
Posted by Andrew on September 14, 2024 at 12:12am 0 Comments 0 Likes
Posted by Denise on September 14, 2024 at 12:12am 0 Comments 0 Likes
download counter wordpress
@RequestMapping(value = "/getDocument", method = RequestMethod.POST) public ResponseEntity getDocument(@ModelAttribute("metaDataForm") MetaData metaData) logger.info(" In WCCController.getDocument() "); try Attachment attachment = new RIDCHelper(ridcUrl,ridcPort,ucmPort).getWCCFile(metaData.getdID(), metaData.getdDocName(), metaData.getdDocAuthor()); return getResponse(metaData.getdDocName(),attachment); > catch (IdcClientException e) // TODO Auto-generated catch block e.printStackTrace(); > catch (IOException e) // TODO Auto-generated catch block e.printStackTrace(); > catch (MimeTypeException e) // TODO Auto-generated catch block e.printStackTrace(); > return null; > private ResponseEntity getResponse(String dDocName,Attachment attachment) throws MimeTypeException logger.info(" In WCCController.getResponse() "); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.parseMediaType(attachment.getContentType())); Random rand = new Random(System.currentTimeMillis()); MimeTypes allTypes = MimeTypes.getDefaultMimeTypes(); MimeType extMime = allTypes.forName(attachment.getContentType()); String ext = extMime.getExtension(); String randomFileName = "/"+dDocName+"_"+Math.abs(rand.nextLong()) + ext; headers.setContentDispositionFormData(randomFileName, randomFileName); headers.setCacheControl("must-reval > ResponseEntity response = new ResponseEntity (attachment.getContent(), headers, HttpStatus.OK); return response; >
© 2024 Created by PH the vintage. Powered by