org.apache.commons.workflow.web
Class ActivityServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.commons.workflow.web.ActivityServlet
All Implemented Interfaces:
Serializable, EventListener, javax.servlet.Servlet, javax.servlet.ServletConfig, ContextListener

public class ActivityServlet
extends javax.servlet.http.HttpServlet
implements ContextListener

Demonstration servlet that illustrates one way that workflow support can be integrated into web applications (or web services) without any dependency on application frameworks. For this implementation, a servlet definition (plus one or more servlet mappings) will be associated with each Activity supported by this web application.

Initialization parameters (defaults in square brackets):

Version:
$Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan
See Also:
Serialized Form

Constructor Summary
ActivityServlet()
           
 
Method Summary
 void afterActivity(ContextEvent event)
          Invoked immediately after execution of the related Activity has been completed normally, been suspended, or been aborted by the throwing of a StepException.
 void afterStep(ContextEvent event)
          Invoked immediately after the specified Step was executed.
 void beforeActivity(ContextEvent event)
          Invoked immediately before execution of the related Activity has started.
 void beforeStep(ContextEvent event)
          Invoked immediately before the specified Step is executed.
 void destroy()
          Perform a graceful shutdown of this servlet instance.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a GET transaction.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a POST transaction.
 void init()
          Perform a graceful startup of this servlet instance.
 void setActivity(Activity activity)
          Set the Activity associated with this instance.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityServlet

public ActivityServlet()
Method Detail

destroy

public void destroy()
Perform a graceful shutdown of this servlet instance.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws IOException,
                  javax.servlet.ServletException
Process a GET transaction.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are processing
Throws:
IOException - if an input/output exception occurs
javax.servlet.ServletException - if a servlet exception occurs

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws IOException,
                   javax.servlet.ServletException
Process a POST transaction.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - The servlet request we are processing
response - The servlet response we are processing
Throws:
IOException - if an input/output exception occurs
javax.servlet.ServletException - if a servlet exception occurs

init

public void init()
          throws javax.servlet.ServletException
Perform a graceful startup of this servlet instance.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if we cannot process the activity definition file for this activity

setActivity

public void setActivity(Activity activity)
Set the Activity associated with this instance.

Parameters:
activity - The new associated Activity

afterActivity

public void afterActivity(ContextEvent event)
Invoked immediately after execution of the related Activity has been completed normally, been suspended, or been aborted by the throwing of a StepException. The Step included in this event will be the last one to be executed.

Specified by:
afterActivity in interface ContextListener
Parameters:
event - The ContextEvent that has occurred

afterStep

public void afterStep(ContextEvent event)
Invoked immediately after the specified Step was executed.

Specified by:
afterStep in interface ContextListener
Parameters:
event - The ContextEvent that has occurred

beforeActivity

public void beforeActivity(ContextEvent event)
Invoked immediately before execution of the related Activity has started. The Step included in this event will be the first one to be executed.

Specified by:
beforeActivity in interface ContextListener
Parameters:
event - The ContextEvent that has occurred

beforeStep

public void beforeStep(ContextEvent event)
Invoked immediately before the specified Step is executed.

Specified by:
beforeStep in interface ContextListener
Parameters:
event - The ContextEvent that has occurred


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.