Announcement Announcement Module
No announcement yet.
Response already commited Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Response already commited

    Hi all,

    This is my first post here, be gentle :-)

    I'm currently integrating an existing security framework in our Spring Web Flow & JSF application. The problem is that this framework sometimes writes in the HttpServletResponse, in this case from a FlowExecutionListenerAdapter.

    In the FlowExecutionListenerAdapter I do the following:

    1. Let the framework do its stuff
    2. Get the native response.
    3. Check if it has been submitted (if the old framework wrote in it).
    4. If so, I have to cancel all actions from Spring Web Flow.

    I've tried numerous things, but I was under the impression that calling context.recordResponseComplete(); would be enough...?

    But I'm getting the following exception:
    Caused by: java.lang.IllegalStateException
    at text.sendRedirectWithStatusCode(WebAppDispatcherCo
    at text.sendRedirect( )
    at dRedirect(
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.sendRedirect(
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.sendFlowExecutionRedirect(FlowHandlerAdap
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handleFlowExecutionResult(FlowHandlerAdap
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(
    at org.springframework.web.servlet.DispatcherServlet. doService(
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
    ... 37 more

    The problem is that Spring Web Flow doesn't check for the 'isResponseComplete' in this case...! It just goes ahead and continues until it gets to sendFlowExecutionRedirect>sendRedirect.

    Why is it still trying to render/redirect when I asked it nicely not to do so? And how can I prevent this from happening?


  • #2
    Fixed in new versions

    Hmm, I've been browsing the history of this forum for a while now looking for my answer (still no replies here).

    I've found a lot of things have been solved in later versions of Web Flow. We are still using 2.0.5. Does anybody know if this is really an issue and if it has been fixed in later versions?


    • #3
      2.0.7 not working either

      Just tested the latest version in our repository, 2.0.7. But it still doesn't work. The problem is the same, the check for isResponseComplete isn't called in all the right places.

      I'll try 2.0.8... but I don't have high hopes.


      • #4
        Got it working..!

        It seems 2.0.7 did fix the bug. It didn't work before because I first called (in one particulair situation):


        And later:


        This combination still causes something unexpected, this causes the request not to be completed, but also throws an IllegalStateException with the response is already committed. Very strange.

        Now I've changed the code into:

        ((HttpServletResponse)(context.getNativeResponse() ).sendRedirect(someUrl);

        This allows me to do a redirect without any interference from Web Flow.


        • #5

          Thank you so much for the information