Announcement Announcement Module
Collapse
No announcement yet.
Response already commited Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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 com.ibm.ws.webcontainer.webapp.WebAppDispatcherCon text.sendRedirectWithStatusCode(WebAppDispatcherCo ntext.java:492)
    at com.ibm.ws.webcontainer.webapp.WebAppDispatcherCon text.sendRedirect(WebAppDispatcherContext.java:449 )
    at com.ibm.ws.webcontainer.srt.SRTServletResponse.sen dRedirect(SRTServletResponse.java:1036)
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.sendRedirect(FlowHandlerAdapter.java:394)
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.sendFlowExecutionRedirect(FlowHandlerAdap ter.java:330)
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handleFlowExecutionResult(FlowHandlerAdap ter.java:297)
    at org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(FlowHandlerAdapter.java:174)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:809)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
    ... 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?

    Roy

  • #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?

    Comment


    • #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.

      Comment


      • #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):

        context.sendExternalRedirect()

        And later:

        context.recordResponseComplete()

        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);
        context.recordResponseComplete();

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

        Comment


        • #5
          Thanks

          Thank you so much for the information

          Comment

          Working...
          X