1 package org.jbpm.webapp.servlet; 2 3 import java.io.IOException ; 4 import java.io.OutputStream ; 5 6 import javax.servlet.ServletException ; 7 import javax.servlet.http.HttpServlet ; 8 import javax.servlet.http.HttpServletRequest ; 9 import javax.servlet.http.HttpServletResponse ; 10 11 import org.jbpm.db.JbpmSession; 12 import org.jbpm.graph.def.ProcessDefinition; 13 14 public class ProcessImageServlet extends HttpServlet { 15 16 private static final long serialVersionUID = 1L; 17 18 protected void doGet(HttpServletRequest request, HttpServletResponse response) 19 throws ServletException , IOException { 20 long processDefinitionId = Long.parseLong( request.getParameter( "definitionId" ) ); 21 JbpmSession jbpmSession = JbpmSession.getCurrentJbpmSession(); 22 ProcessDefinition processDefinition = jbpmSession.getGraphSession().loadProcessDefinition(processDefinitionId); 23 byte[] bytes = processDefinition.getFileDefinition().getBytes("processimage.jpg"); 24 OutputStream out = response.getOutputStream(); 25 out.write(bytes); 26 out.flush(); 27 28 } 34 } 35 | Popular Tags |