Java Code Examples for org.activiti.engine.task.Attachment#getName()

The following examples show how to use org.activiti.engine.task.Attachment#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttachmentController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 下载附件
 *
 * @throws IOException
 */
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
    Attachment attachment = taskService.getAttachment(attachmentId);
    InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
    String contentType = StringUtils.substringBefore(attachment.getType(), ";");
    response.addHeader("Content-Type", contentType + ";charset=UTF-8");
    String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
    String fileName = attachment.getName() + "." + extensionFileName;
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}
 
Example 2
Source File: AttachmentController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 下载附件
 *
 * @throws IOException
 */
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
    Attachment attachment = taskService.getAttachment(attachmentId);
    InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
    String contentType = StringUtils.substringBefore(attachment.getType(), ";");
    response.addHeader("Content-Type", contentType + ";charset=UTF-8");
    String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
    String fileName = attachment.getName() + "." + extensionFileName;
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}
 
Example 3
Source File: AttachmentController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 下载附件
 *
 * @throws IOException
 */
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
    Attachment attachment = taskService.getAttachment(attachmentId);
    InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
    String contentType = StringUtils.substringBefore(attachment.getType(), ";");
    response.addHeader("Content-Type", contentType + ";charset=UTF-8");
    String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
    String fileName = attachment.getName() + "." + extensionFileName;
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}
 
Example 4
Source File: AttachmentController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 下载附件
 *
 * @throws IOException
 */
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
    Attachment attachment = taskService.getAttachment(attachmentId);
    InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
    String contentType = StringUtils.substringBefore(attachment.getType(), ";");
    response.addHeader("Content-Type", contentType + ";charset=UTF-8");
    String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
    String fileName = attachment.getName() + "." + extensionFileName;
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}
 
Example 5
Source File: AttachmentController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 下载附件
 *
 * @throws IOException
 */
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
    Attachment attachment = taskService.getAttachment(attachmentId);
    InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
    String contentType = StringUtils.substringBefore(attachment.getType(), ";");
    response.addHeader("Content-Type", contentType + ";charset=UTF-8");
    String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
    String fileName = attachment.getName() + "." + extensionFileName;
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}
 
Example 6
Source File: AttachmentController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 下载附件
 *
 * @throws IOException
 */
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
    Attachment attachment = taskService.getAttachment(attachmentId);
    InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
    String contentType = StringUtils.substringBefore(attachment.getType(), ";");
    response.addHeader("Content-Type", contentType + ";charset=UTF-8");
    String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
    String fileName = attachment.getName() + "." + extensionFileName;
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}