Spring webflow 1.0 - Downloading a file

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-06-16T18:31:44Z Indexed on 2010/06/17 13:33 UTC
Read the original article Hit count: 331

Filed under:

I am using spring webflow 1.0. I am uploading a csv file, parsing it, and displying results before proceeding. The user has an option to download a csv file that contains the records that did not pass validation. When I click the link in a JSP to download this file, webflow invokes a form Action. The form action writes out a file via getting the output stream off the response:

HttpServletResponse response = ((ServletExternalContext) context.getExternalContext()).getResponse();

I do not want to leave the jsp I'm currently on. I just want to download the file. In other words, I do not want to transition to another state. I just want to serve the dynamically rendered file. Everything works (I don't leave the page, and I download the file), but I'm getting the following error in my console:

_pEncydKfggPHJo8=org.springframework.webflow.engine.NoMatchingTransitionException: No transition was matched on the event(s) signaled by the [1] action(s) that executed in this action state 'downloadErrorReportAction' of flow 'myFlow'; transitions must be defined to handle action result outcomes -- possible flow configuration error? Note: the eventIds signaled were: 'array<String>[[null]]', while the supported set of transitional criteria for this action state is 'array<TransitionCriteria>[[empty]]'
    at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:187)
    at org.springframework.webflow.engine.State.enter(State.java:191)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:212)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:107)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:534)
    Truncated. see log file for complete stacktrace

Here is the relevant portion of my webflow config.

<view-state id="showUploadResults" view="UploadResults3.0">
    <render-actions>
        <action bean="UploadResultsAction" method="transitionToWebflow"/>
        <action bean="UploadResultsAction" method="setupData"/>
    </render-actions>
    <transition on="submit" to="proceed"/>
    <transition on="downloadErrorReport" to="downloadErrorReportAction"/>
</view-state>

<action-state id="downloadErrorReportAction">
    <action bean="UploadResultsAction" method="downloadErrorReport" name="downloadErrorReport"/>
</action-state>

© Stack Overflow or respective owner

Related posts about spring-webflow