Grails 2.0.1 and WebFlow: accessing the flow scope outside of flow

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails 2.0.1 and WebFlow: accessing the flow scope outside of flow

Konstantyn Smirnov
This post was updated on .
Hi All

In my controller I have a flow with several actions and an imageUpload() action which is needed for asynch upload.

in there I'm updating the state of the flow with the images the user uploads, so that in the end of the flow the images could be saved or rejected.

def imageUpload(){
    def er = grailsApplication.mainContext.getBean( 'flowExecutor' ).executionRepository
    def flowSession = er.getFlowExecution( er.parseFlowExecutionKey( params.list( 'execution' )[ 0 ] ) ).flowSessions[ 0 ]
    def flow = flowSession.scope

    def file = request.getFile( 'file' )
    imageService.saveImage file.originalFilename, flow.imagesMap, f.bytes // here the flow.imagesMap is filled with the new image

    //do some other stuff
}

the problem is, that upon each call of this action (with the flow started), the flowSession object is always new, e.g. flow.imagesMap is always empty.

What am I missing here?

TIA,
Konstantyn
Reply | Threaded
Open this post in threaded view
|

Re: Grails 2.0.1 and WebFlow: accessing the flow scope outside of flow

houbie
Webflow keeps serialized snapshots of the execution state and (de)serializes flow scope during state transitions, so if you start messing with the flow scope outside of a flow, I would expect problems with back/forward navigation.
I recommend integrating the file upload in your flow.

Grtz,
Ivo
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email