public class DemoFileControllerServiceImpl extends FileControllerServiceImpl
DELETE_FILE_UPLOAD_LINE_DIALOG| Constructor and Description |
|---|
DemoFileControllerServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
sendFileFromLineResponse(UifFormBase form,
javax.servlet.http.HttpServletResponse response,
List<FileMeta> collection,
FileMeta fileLine)
Hook controller method to send a response back by using response.flushBuffer() using request/collection/fileLine
information provided.
|
addFileUploadLine, deleteFileUploadLine, getCollectionControllerService, getFileFromLine, getModelAndViewService, setCollectionControllerService, setModelAndViewServicepublic DemoFileControllerServiceImpl()
protected void sendFileFromLineResponse(UifFormBase form, javax.servlet.http.HttpServletResponse response, List<FileMeta> collection, FileMeta fileLine)
A sample implementation may look like:
if (fileLine instanceof FileMetaBlob) {
InputStream is = ((FileMetaBlob) fileLine).getBlob().getBinaryStream();
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", "attachment; filename=" + fileLine.getName());
// copy it to response's OutputStream
FileCopyUtils.copy(is, response.getOutputStream());
response.flushBuffer();
}
sendFileFromLineResponse in class FileControllerServiceImplform - form instance containing the file request dataresponse - Http response object for streaming back the file contentscollection - collection the file object belongs tofileLine - the particular file line instance the contents should be sent back forCopyright © 2005–2015 The Kuali Foundation. All rights reserved.