activiti获取模型图片或部署图片
@RequestMapping(value = "/imageBase64")
public String imageBase64(String deploymentId, String type) {
String image = "";
if ("deploy".equals(type)) {
List<String> names = repositoryService.getDeploymentResourceNames(deploymentId);
String imageName = null;
for (String name : names) {
if (name.indexOf(".png") >= 0) {
imageName = name;
break;
}
}
InputStream in = repositoryService.getResourceAsStream(deploymentId, imageName);
image = Base64Convert.getBase64FromInputStream(in);
} else if ("model".equals(type)) {
byte[] bytes = repositoryService.getModelEditorSourceExtra(deploymentId);
image = Base64.encodeBase64String(bytes);
}
return "data:image/png;base64," + image;
}