01: package org.emforge.jbpm.web;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: import javax.servlet.ServletException;
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09:
10: import org.emforge.BpmService;
11: import org.emforge.jbpm.web.bean.WorkflowController;
12:
13: import ru.emdev.EmForge.util.Helper;
14:
15: /**
16: * Servlet implementation class for Servlet: ProcessImageServlet
17: *
18: * @web.servlet
19: * name="ProcessImageServlet"
20: * display-name="ProcessImageServlet"
21: *
22: * @web.servlet-mapping
23: * url-pattern="/processimage"
24: *
25: */
26: public class ProcessImageServlet extends javax.servlet.http.HttpServlet
27: implements javax.servlet.Servlet {
28: private static final long serialVersionUID = -148999906834810558L;
29:
30: /* (non-Java-doc)
31: * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32: * @note [AKA]I've got it from JBoss web-example application
33: */
34: protected void doGet(HttpServletRequest i_request,
35: HttpServletResponse o_response) throws ServletException,
36: IOException {
37: long workflowId = Long.parseLong(i_request
38: .getParameter(WorkflowController.WORKFLOW_ID_ATTR));
39:
40: BpmService bpmService = Helper.getBpmService(i_request);
41:
42: byte[] bytes = bpmService.getWorkflowImage(workflowId);
43: OutputStream out = o_response.getOutputStream();
44: out.write(bytes);
45: out.flush();
46: }
47: }
|