org.codehaus.waffle.action
Class DefaultActionMethodResponseHandler

java.lang.Object
  extended by org.codehaus.waffle.action.DefaultActionMethodResponseHandler
All Implemented Interfaces:
ActionMethodResponseHandler

public class DefaultActionMethodResponseHandler
extends java.lang.Object
implements ActionMethodResponseHandler

Handler that will make decisions based on what is returned from the action method:

  1. A View response will be directed (either redirected or forwarded)
  2. A ActionMethodException will set the response status and sends the message directly (perfect for ajax).
  3. Otherwise the response value will be sent directly to the browser as a String via Object.toString() method.

Author:
Michael Ward, Mauro Talevi

Constructor Summary
DefaultActionMethodResponseHandler(ViewDispatcher viewDispatcher, ActionMonitor actionMonitor)
           
 
Method Summary
 void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ActionMethodResponse actionMethodResponse)
          Custom implementation of this interface will be able to act in response to the values returned from an ActionMethod.
protected  void handleResponse(javax.servlet.http.HttpServletResponse response, java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultActionMethodResponseHandler

public DefaultActionMethodResponseHandler(ViewDispatcher viewDispatcher,
                                          ActionMonitor actionMonitor)
Method Detail

handle

public void handle(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response,
                   ActionMethodResponse actionMethodResponse)
            throws java.io.IOException,
                   javax.servlet.ServletException
Description copied from interface: ActionMethodResponseHandler
Custom implementation of this interface will be able to act in response to the values returned from an ActionMethod. Regardless of the implementation an ActionMethodResponse value of null should return to the referring page.

Specified by:
handle in interface ActionMethodResponseHandler
actionMethodResponse - - a value of null should return to the refering page
Throws:
java.io.IOException
javax.servlet.ServletException

handleResponse

protected void handleResponse(javax.servlet.http.HttpServletResponse response,
                              java.lang.String message)
                       throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2008. All Rights Reserved.