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

This handler will make decisions based on what is returned from the action method. For example:

- A View response indicates which view the user should be directed (either redirected or forwarded) to.

- An exception sets the response status to 400 and sends the mesage directly (perfect for ajax)

- otherwise the response value will be sent directly to the browser as a String via Object.toString().

Author:
Michael Ward

Constructor Summary
DefaultActionMethodResponseHandler(ViewDispatcher viewDispatcher, ActionMonitor monitor)
           
 
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 monitor)
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 © 2007 null. All Rights Reserved.