GetProcess.java
上传用户:ahit0551
上传日期:2009-04-15
资源大小:2345k
文件大小:2k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. package name.xio.xiorkflow.web;
  2. import javax.servlet.http.HttpServletRequest;
  3. import javax.servlet.http.HttpServletResponse;
  4. import name.xio.xiorkflow.domain.Process;
  5. import name.xio.xiorkflow.domain.ProcessResult;
  6. import name.xio.xiorkflow.domain.logic.ProcessService;
  7. import name.xio.xml.SimpleXMLWorkShop;
  8. import org.apache.commons.logging.Log;
  9. import org.apache.commons.logging.LogFactory;
  10. import org.jdom.Document;
  11. import org.springframework.web.servlet.ModelAndView;
  12. import org.springframework.web.servlet.mvc.Controller;
  13. public class GetProcess implements Controller {
  14.     public ModelAndView handleRequest(HttpServletRequest request,
  15.             HttpServletResponse response) throws Exception {
  16.         request.setCharacterEncoding("UTF-8");
  17.         String name = request.getParameter("name");
  18.         log.info("get process:" + name);
  19.         ProcessResult processResult = this.getProcessService().getProcess(name);
  20.         Process process = processResult.getProcess();
  21.         response.setContentType("text/xml");
  22.         response.setHeader("Cache-Control", "no-cache");
  23.         Document doc = null;
  24.         if (process != null) {
  25.             doc = process.getDoc();
  26.         }
  27.         doc = (doc == null) ? ProcessResult.convertXml(processResult) : doc;
  28.         SimpleXMLWorkShop.outputXML(doc, response.getOutputStream());
  29.         //not redirect to other view,it processed on response
  30.         return null;
  31.     }
  32.     /**
  33.      * @return Returns the processService.
  34.      */
  35.     public ProcessService getProcessService() {
  36.         return processService;
  37.     }
  38.     /**
  39.      * @param processService The processService to set.
  40.      */
  41.     public void setProcessService(ProcessService processService) {
  42.         this.processService = processService;
  43.     }
  44.     private Log log = LogFactory.getLog(GetProcess.class);
  45.     private ProcessService processService;
  46. }