You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/06/27 17:10:25 UTC

svn commit: r958390 - /click/trunk/click/framework/src/org/apache/click/ClickServlet.java

Author: sabob
Date: Sun Jun 27 15:10:24 2010
New Revision: 958390

URL: http://svn.apache.org/viewvc?rev=958390&view=rev
Log:
encapsulate page action in method and added trace logging

Modified:
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java

Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=958390&r1=958389&r2=958390&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Sun Jun 27 15:10:24 2010
@@ -595,9 +595,9 @@ public class ClickServlet extends HttpSe
             // Handle page method
             String pageAction = context.getRequestParameter(Page.PAGE_ACTION);
             if (pageAction != null) {
-                continueProcessing = false;
                 // Returned partial could be null
-                partial = ClickUtils.invokeAction(page, pageAction);
+                partial = performPageAction(page, pageAction, context);
+                continueProcessing = false;
             }
         }
 
@@ -638,6 +638,33 @@ public class ClickServlet extends HttpSe
     }
 
     /**
+     * Perform the page action for the given page and return the Partial response.
+     *
+     * @param page the page which action to perform
+     * @param pageAction the name of the page action
+     * @param context the request context
+     * @return the page action Partial response
+     */
+    protected Partial performPageAction(Page page, String pageAction, Context context) {
+        Partial partial = ClickUtils.invokeAction(page, pageAction);
+
+        if (logger.isTraceEnabled()) {
+            HtmlStringBuffer buffer = new HtmlStringBuffer();
+            String pageClassName = ClassUtils.getShortClassName(page.getClass());
+            buffer.append("   invoked: ");
+            buffer.append(pageClassName);
+            buffer.append(".").append(pageAction).append("() : ");
+            if (partial == null) {
+                buffer.append("null (*no* Partial was returned by PageAction)");
+            } else {
+                buffer.append(ClassUtils.getShortClassName(partial.getClass()));
+            }
+            logger.trace(buffer.toString());
+        }
+        return partial;
+    }
+
+    /**
      * Perform the onInit event callback for the specified page.
      *
      * @param page the page to initialize
@@ -1766,7 +1793,10 @@ public class ClickServlet extends HttpSe
             String pageAction = context.getRequestParameter(Page.PAGE_ACTION);
             if (pageAction != null) {
                 continueProcessing = false;
-                partial = ClickUtils.invokeAction(page, pageAction);
+
+                // Returned partial could be null
+                partial = performPageAction(page, pageAction, context);
+
                 callbackDispatcher.processPreResponse(context);
                 callbackDispatcher.processPreGetHeadElements(context);