activiti导出xml

来源:互联网 发布:淘宝外卖显示系统繁忙 编辑:程序博客网 时间:2024/06/10 16:38
String id = request.getParameter("modelId");BufferedOutputStream bos = null;try {try {Model modelData = repositoryService.getModel(id);byte[] bpmnBytes = repositoryService.getModelEditorSource(modelData.getId());// 封装输出流bos = new BufferedOutputStream(response.getOutputStream());bos.write(bpmnBytes);// 写入流String filename = modelData.getId() + ".bpmn20.xml";response.setContentType("application/x-msdownload;");response.setHeader("Content-Disposition","attachment; filename=" + filename);response.flushBuffer();} finally {bos.flush();bos.close();}} catch (Exception e) {System.out.println("流程部署失败");e.printStackTrace();}