Revision: 1157
          http://stripes.svn.sourceforge.net/stripes/?rev=1157&view=rev
Author:   fdaoud
Date:     2009-10-08 00:45:07 +0000 (Thu, 08 Oct 2009)

Log Message:
-----------
Event handler return value in execution context

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
    trunk/stripes/src/net/sourceforge/stripes/controller/ExecutionContext.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java  
2009-10-03 14:17:17 UTC (rev 1156)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java  
2009-10-08 00:45:07 UTC (rev 1157)
@@ -455,13 +455,14 @@
             public Resolution intercept(ExecutionContext ctx) throws Exception 
{
                 Object returnValue = handler.invoke(bean);
                 fillInValidationErrors(ctx);
+                ctx.setHandlerReturnValue(returnValue);
 
                 if (returnValue != null && returnValue instanceof Resolution) {
                     ctx.setResolutionFromHandler(true);
                     return (Resolution) returnValue;
                 }
                 else if (returnValue != null) {
-                    log.warn("Expected handler method ", handler.getName(), " 
on class ",
+                    log.debug("Expected handler method ", handler.getName(), " 
on class ",
                              bean.getClass().getSimpleName(), " to return a 
Resolution. Instead it ",
                              "returned: ", returnValue);
                 }

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/ExecutionContext.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/ExecutionContext.java  
2009-10-03 14:17:17 UTC (rev 1156)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/ExecutionContext.java  
2009-10-08 00:45:07 UTC (rev 1157)
@@ -50,6 +50,7 @@
     private ActionBeanContext actionBeanContext;
     private ActionBean actionBean;
     private Method handler;
+    private Object handlerReturnValue;
     private Resolution resolution;
     private LifecycleStage lifecycleStage;
     private boolean resolutionFromHandler = false;
@@ -122,7 +123,7 @@
      * Retrieves the handler Method that is targeted by the current request. 
Available
      * to interceptors only after {...@link LifecycleStage#HandlerResolution} 
has occurred.
      *
-     * @return the current ActionBean instance, or null if not yet resolved
+     * @return the current handler method, or null if not yet resolved
      */
     public Method getHandler() { return handler; }
 
@@ -130,6 +131,19 @@
     public void setHandler(Method handler) { this.handler = handler; }
 
     /**
+     * Retrieves the value that was returned by the handler method. Available
+     * to interceptors only after {...@link LifecycleStage#EventHandling} has 
occurred.
+     *
+     * @return the value that was returned by the handler method (could be 
null)
+     */
+    public Object getHandlerReturnValue() { return handlerReturnValue; }
+
+    /** Sets the value that was returned by the handler method. */
+    public void setHandlerReturnValue(Object handlerReturnValue) {
+        this.handlerReturnValue = handlerReturnValue;
+    }
+
+    /**
      * Gets the Resolution that will be executed at the end of the execution. 
This value
      * is generally not populated until just prior to {...@link 
LifecycleStage#ResolutionExecution}.
      *


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to