diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java
index 03b0fb25..e5e9e87d 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java
@@ -186,14 +186,6 @@ public abstract class AbstractAction implements Action, InitializingBean {
Event result = doPreExecute(context);
if (result == null) {
result = doExecute(context);
- if (logger.isDebugEnabled()) {
- if (result != null) {
- logger.debug("Action '" + getActionNameForLogging() + "' completed execution; result is '"
- + result.getId() + "'");
- } else {
- logger.debug("Action '" + getActionNameForLogging() + "' completed execution; result is [null]");
- }
- }
doPostExecute(context);
} else {
if (logger.isInfoEnabled()) {
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java
index dbfc66c1..aed74982 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java
@@ -15,6 +15,8 @@
*/
package org.springframework.webflow.engine;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
@@ -28,6 +30,8 @@ import org.springframework.webflow.execution.RequestContext;
*/
public class ActionExecutor {
+ private static final Log logger = LogFactory.getLog(AnnotatedAction.class);
+
/**
* Private constructor to avoid instantiation.
*/
@@ -44,7 +48,14 @@ public class ActionExecutor {
*/
public static Event execute(Action action, RequestContext context) throws ActionExecutionException {
try {
- return action.execute(context);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Executing action " + getTargetAction(action));
+ }
+ Event event = action.execute(context);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Action execution completed; result = " + event);
+ }
+ return event;
} catch (ActionExecutionException e) {
throw e;
} catch (Exception e) {
@@ -54,4 +65,12 @@ public class ActionExecutor {
.getAttributes(), e);
}
}
+
+ private static Action getTargetAction(Action action) {
+ if (action instanceof AnnotatedAction) {
+ return getTargetAction(((AnnotatedAction) action).getTargetAction());
+ } else {
+ return action;
+ }
+ }
}
\ No newline at end of file
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java
index e2053ca3..b81be007 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java
@@ -15,6 +15,8 @@
*/
package org.springframework.webflow.engine;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -36,6 +38,8 @@ import org.springframework.webflow.execution.RequestContext;
*/
public class AnnotatedAction extends AnnotatedObject implements Action {
+ private static final Log logger = LogFactory.getLog(AnnotatedAction.class);
+
// well known attributes
/**
@@ -138,10 +142,16 @@ public class AnnotatedAction extends AnnotatedObject implements Action {
public Event execute(RequestContext context) throws Exception {
try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Putting action execution attributes " + getAttributes());
+ }
context.getAttributes().putAll(getAttributes());
Event result = getTargetAction().execute(context);
return postProcessResult(result);
} finally {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Clearing action execution attributes " + getAttributes());
+ }
context.getAttributes().removeAll(getAttributes());
}
}
@@ -160,6 +170,10 @@ public class AnnotatedAction extends AnnotatedObject implements Action {
if (isNamed()) {
// qualify result event id with action name for a named action
String qualifiedId = getName() + "." + resultEvent.getId();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Qualifying action result '" + resultEvent.getId() + "'; qualified result = '"
+ + qualifiedId + "'");
+ }
resultEvent = new Event(resultEvent.getSource(), qualifiedId, resultEvent.getAttributes());
}
return resultEvent;
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java
index 90e9539d..71e0872f 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java
@@ -98,6 +98,5 @@ public interface Action {
* recoverable exceptions should be caught within this method and an appropriate result outcome returned
* or be handled by the current state of the calling flow execution.
*/
- // TODO consider changing the execute return value to a simple string for 2.0
public Event execute(RequestContext context) throws Exception;
}
\ No newline at end of file
diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java
index fda4c5cc..b5ffab5f 100644
--- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java
+++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java
@@ -73,6 +73,10 @@ public class FormActionTests extends TestCase {
public static class TestBeanValidator implements Validator {
private boolean invoked;
+ public boolean getInvoked() {
+ return invoked;
+ }
+
public boolean supports(Class clazz) {
return TestBean.class.equals(clazz);
}
diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java
index de4bf7b4..aab9bce4 100644
--- a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java
+++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java
@@ -5,6 +5,8 @@ import junit.framework.TestCase;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.validation.BindingResult;
+import org.springframework.webflow.action.FormAction;
+import org.springframework.webflow.action.FormActionTests.TestBeanValidator;
import org.springframework.webflow.definition.StateDefinition;
import org.springframework.webflow.engine.Flow;
import org.springframework.webflow.engine.builder.FlowAssembler;
@@ -313,9 +315,12 @@ public class XmlFlowModelBuilderTests extends TestCase {
}
}));
FlowExecution execution = factory.createFlowExecution(flow);
+ FormAction action = (FormAction) flow.getApplicationContext().getBean("formAction");
+ assertFalse(((TestBeanValidator) action.getValidator()).getInvoked());
execution.start(null, new MockExternalContext());
MockExternalContext context = new MockExternalContext();
context.setEventId("submit");
execution.resume(context);
+ assertTrue(((TestBeanValidator) action.getValidator()).getInvoked());
}
}