Spring webflow 1.0 - File Download

I am using spring webflow 1.0. I download the csv file, parse it and return the results before continuing. The user has the ability to download a csv file containing entries that did not pass the test. When I click the link in JSP to download this file, webflow calls the Action form. The form action writes the file through receiving the output stream from the response:

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

I do not want to leave jsp in which I am now. I just want to upload a file. In other words, I do not want to move to another state. I just want to serve a dynamically displayed file. Everything works (I do not leave the page, and I upload the file), but the following error appears 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 part of my webflow configuration.

<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>
+3
1

, .

<view-state id="downloadErrorReportAction">
        <render-actions>
            <action bean="uploadResultsAction" method="downloadErrorReport" name="downloadErrorReport"/>
        </render-actions>
    </view-state>

, , , . , :

<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>

<view-state id="downloadErrorReportAction">
     <render-actions>
         <action bean="uploadResultsAction" method="downloadErrorReport" name="downloadErrorReport"/>
     </render-actions>
    <transition on="submit" to="proceed"/>
</view-state>
+2

Source: https://habr.com/ru/post/1750352/


All Articles