Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4674

StrutsPrepareAndExecuteFilter should check for response commited status

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.30
    • Fix Version/s: 2.3.31, 2.5.5
    • Component/s: None
    • Labels:
      None

      Description

      In StrutsPrepareAndExecuteFilter in doFilter method there is a code fragment

      ActionMapping mapping = this.prepare.findActionMapping(request, response, true);
      if(mapping == null) {
          boolean handled = this.execute.executeStaticResourceRequest(request, response);
          if(!handled) {
                 chain.doFilter(request, response);
          }
      } else {
          this.execute.executeAction(request, response, mapping);
      }
      

      Problem is that this.prepare.findActionMapping(request, response, true) can commit response (in case of exception), but filter continues with execution of chain, in my case causing problems up in the chain.

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-JDK6-support-2.3 #1049 (See https://builds.apache.org/job/Struts-JDK6-support-2.3/1049/)
        WW-4674 Uses the same logic as in Dispatcher to control handling (lukaszlenart: rev b348fc552c3265707181db4a42a41abc72b98488)

        • (edit) core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
        • (edit) core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK6-support-2.3 #1049 (See https://builds.apache.org/job/Struts-JDK6-support-2.3/1049/ ) WW-4674 Uses the same logic as in Dispatcher to control handling (lukaszlenart: rev b348fc552c3265707181db4a42a41abc72b98488) (edit) core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java (edit) core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-JDK7-master #526 (See https://builds.apache.org/job/Struts-JDK7-master/526/)
        WW-4674 Uses the same logic as in Dispatcher to control handling (lukaszlenart: rev 459e198022e8b96e9c3d5f97b1d4c428794ffb96)

        • (edit) core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
        • (edit) core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #526 (See https://builds.apache.org/job/Struts-JDK7-master/526/ ) WW-4674 Uses the same logic as in Dispatcher to control handling (lukaszlenart: rev 459e198022e8b96e9c3d5f97b1d4c428794ffb96) (edit) core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java (edit) core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Done, you can disable handling exception by Struts setting struts.handle.exception to false

        Show
        lukaszlenart Lukasz Lenart added a comment - Done, you can disable handling exception by Struts setting struts.handle.exception to false
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit b348fc552c3265707181db4a42a41abc72b98488 in struts's branch refs/heads/support-2-3 from Lukasz Lenart
        [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=b348fc5 ]

        WW-4674 Uses the same logic as in Dispatcher to control handling exception

        Show
        jira-bot ASF subversion and git services added a comment - Commit b348fc552c3265707181db4a42a41abc72b98488 in struts's branch refs/heads/support-2-3 from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=b348fc5 ] WW-4674 Uses the same logic as in Dispatcher to control handling exception
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 459e198022e8b96e9c3d5f97b1d4c428794ffb96 in struts's branch refs/heads/master from Lukasz Lenart
        [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=459e198 ]

        WW-4674 Uses the same logic as in Dispatcher to control handling exception

        Show
        jira-bot ASF subversion and git services added a comment - Commit 459e198022e8b96e9c3d5f97b1d4c428794ffb96 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=459e198 ] WW-4674 Uses the same logic as in Dispatcher to control handling exception
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        In Dispatcher there is already

            @Inject(StrutsConstants.STRUTS_HANDLE_EXCEPTION)
            public void setHandleException(String handleException) {
                this.handleException = Boolean.parseBoolean(handleException);
            }
        

        which we can use to do the same in findActionMapping()

        Show
        lukaszlenart Lukasz Lenart added a comment - In Dispatcher there is already @Inject(StrutsConstants.STRUTS_HANDLE_EXCEPTION) public void setHandleException( String handleException) { this .handleException = Boolean .parseBoolean(handleException); } which we can use to do the same in findActionMapping()

          People

          • Assignee:
            Unassigned
            Reporter:
            mhankus Mirek Hankus
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development