Members

 

download counter wordpress


Name: download counter wordpress
Category: Soft
Published: therspittcircdi1987
Language: English

 


 


 

 

 

 

 

 

 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 

@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; >
WebCenter Content R >
public Attachment getWCCFile(String dID,String dDocName,String username) throws IdcClientException, IOException > IdcClient client = getIdcClient(); DataBinder dataBinderReq = client.createBinder(); dataBinderReq.putLocal("IdcService", "GET_FILE"); dataBinderReq.putLocal("dID", dID); dataBinderReq.putLocal("dDocName", dDocName); dataBinderReq.putLocal("allowInterrupt", "1"); dataBinderReq.putLocal("RevisionSelectionMethod", "LatestReleased"); ServiceResponse severiceResponse = client.sendRequest(idcContext, dataBinderReq); InputStream inputStream = severiceResponse.getResponseStream(); byte[] bytes = IOUtils.toByteArray(inputStream); Attachment attachment = new Attachment(bytes,0,bytes.length); attachment.setContentType(severiceResponse.getHeader("Content-Type")); attachment.setFileName(severiceResponse.getHeader("filename")); attachment.setContentLength(severiceResponse.getHeader("Content-Length")); return attachment; >
2. Attachment Class public class Attachment private byte[] content; private int offset; private int length; private String contentType; private String extension; private String fileName; private String contentLength; >
1. Method to getFile.
Sunday, August 23, 2015.
RIDC Call to Download File for Spring.
4. Data save and retrieval through jdbc utility.
3. Spring Controller.
Knowledge blog.

http://nisaddvilli.eklablog.com/a2-times-azlat-download-apps-a18023...

Views: 1

Comments are closed for this blog post

© 2024   Created by PH the vintage.   Powered by

Badges  |  Report an Issue  |  Terms of Service