Package testservlet

Source Code of testservlet.Servlet

/*
* This file is part of the WfMOpen project.
* Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* $Id: Servlet.java 1607 2006-09-29 12:32:13Z drmlipp $
*
* $Log$
* Revision 1.1.1.1  2003/12/19 13:01:50  drmlipp
* Updated to 1.1rc1
*
* Revision 1.1  2003/11/11 10:51:25  lipp
* New "test".
*
*/
package testservlet;

import java.io.IOException;

import java.util.Iterator;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import de.danet.an.workflow.api.ProcessDefinition;
import de.danet.an.workflow.api.ProcessDefinitionDirectory;
import de.danet.an.workflow.api.WorkflowService;
import de.danet.an.workflow.api.WorkflowServiceFactory;

/**
* This class provides ...
*
* @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
* @version $Revision: 1607 $
*/

public class Servlet extends HttpServlet {

    private static final org.apache.commons.logging.Log logger
  = org.apache.commons.logging.LogFactory.getLog(Servlet.class);   

    /**
     * Describe <code>init</code> method here.
     *
     * @param servletConfig a <code>ServletConfig</code> value
     * @exception ServletException if an error occurs
     */
    public void init(ServletConfig servletConfig) throws ServletException {
    }
   
    /**
     * Describe <code>doPost</code> method here.
     *
     * @param request a <code>HttpServletRequest</code> value
     * @param response a <code>HttpServletResponse</code> value
     * @exception ServletException if an error occurs
     * @exception IOException if an error occurs
     */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  doPost (request, response);
    }

    /**
     * Describe <code>doGet</code> method here.
     *
     * @param request a <code>HttpServletRequest</code> value
     * @param response a <code>HttpServletResponse</code> value
     * @exception ServletException if an error occurs
     * @exception IOException if an error occurs
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  response.setContentType("text/html");
        ServletOutputStream out = response.getOutputStream();
        out.println("<html>");
        out.println("<head><title>Test Servlet</title></head>");
        out.println("<body>");
        out.println("<h1>Process definitions</h1>");

  WorkflowService wfs = null;
  ProcessDefinitionDirectory pdd = null;
  try {
      WorkflowServiceFactory wfsf = WorkflowServiceFactory.newInstance ();
      wfs = wfsf.newWorkflowService();
      pdd = wfs.processDefinitionDirectory();
      for (Iterator i = pdd.processDefinitions().iterator ();
     i.hasNext();) {
    ProcessDefinition pd = (ProcessDefinition)i.next ();
    out.println(pd.packageName() + "/" + pd.processName() + "<br>");
      }
  } finally {
      if (wfs != null) {
    wfs.release(pdd);
    wfs.release(wfs);
      }
  }
        out.println("</body></html>");
    }
}
TOP

Related Classes of testservlet.Servlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.