Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Release 1.5
-
Fix Version/s: Release 1.5
-
Component/s: None
-
Labels:None
-
Environment:Affects Stripes revision 905
Description
If I return a RedirectResolution calling a method from current action bean and I flash the action bean, the event in action bean's context is not correct.
Let's say I have 2 handler.
public Resolution update() {
return new RedirectResolution(this.getClass(), "done").flash(this);
}
public Resolution done() {
System.out.println(context.getEventName());
return new ForwardResolution("/index.jsp");
}
The output will be "update" instead of "done".
The problem is described in this email I've sent to the list.
I narrowed down the problem to a combination of what AnnotatedClassActionResolver and DispathHelper do.
In AnnotatedClassActionResolver method ActionBean getActionBean(ActionBeanContext context, String path):
The bean returned is the bean from previous request and the ActionBeanContext is not updated except for request property.
Then DispatchHelper sets the bean as ActionBean in ExecutionContext, but does not update ExecutionContext's ActionBeanContext.
When DispatchHelper sets the event name, it sets in in ExecutionContext's ActionBeanContext, but not in ActionBean's ActionBeanContext.
So we have 2 different events. One in ExecutionContext and one in the ActionBean.
The Wizard throws an exception because it checks startEvents againts ActionBean's context which is not the event that will be called.
A possible patch is to update eventName in ActionBean's ActionBeanContext in DispatchHelper's resolveHandler method.
Path is included in email.
Christian
Included a possible patch for the problem. The difference is in resolveHandler method.
// Then lookup the event name and handler method etc.
String eventName = resolver.getEventName(bean.getClass(), context);
context.setEventName(eventName);
// Patch start.
bean.getContext().setEventName(eventName);
// Patch end.