Grails

all functions called from inside of a webFlow are interpreted as events, and return events rather than the objects you might be trying to return

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.0.3, 1.1
  • Fix Version/s: 1.1.1
  • Component/s: WebFlow
  • Labels:
    None

Description

Calls to methods inside the controller class, from a webFlow, are considered calls to webFlow events, and return an event rather than something you might be trying to return. I found this out because I kept getting "result" stuck into the model rather than an actual object I was trying to create.

A workaround from Graeme:
> The problem seems to be that the calls to the methods
> createOrLoadSeries(flow,params) and createOrLoadSnapshot(flow,params)
> are actually returning webflow events. This could well be regarded as
> a bug, but the reason it behaves this way is that the closure is set
> to resolve methods to the webflow first as you can see from this line:
>
> http://svn.grails.codehaus.org/browse/grails/trunk/grails/src/groovy/org/codeh
> aus/groovy/grails/webflow/engine/builder/ClosureInvokingAction.groovy?r=7257#l
> 104
>
> The result is that it will result to the flow, which will create an
> event called "createOrLoadSeries" and return it. You can get around
> this by prefixing these calls with "this." which will ensure they
> result to the outer class rather than the flow:
>
> flow.series = this.createOrLoadSeries(flow,params);
> flow.snapshot = this.createOrLoadSnapshot(flow,params);
>
> This could well be regarded as a bug and feel free to raise an issue.
> The reason I believe the behavior is the way it is is because if it
> resolved to the class first, then it would pick up controller scopes
> such as "flash" rather than the webflow scopes of the same name.
>
> We'd have to consider how to implement the code in a different way to
> avoid this conflict.

Activity

Hide
Marc Palmer added a comment -

This seemed OK for us in 1.0.4 but is broken and returning "result" again in Grails 1.1

Show
Marc Palmer added a comment - This seemed OK for us in 1.0.4 but is broken and returning "result" again in Grails 1.1
Hide
Graeme Rocher added a comment -

fixed in Git master

Show
Graeme Rocher added a comment - fixed in Git master
Hide
Jan Rudert added a comment -

Please reopen, this issue is not fixed for webflow tests.

Show
Jan Rudert added a comment - Please reopen, this issue is not fixed for webflow tests.
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: