Spring Roo
  1. Spring Roo
  2. ROO-1908

Modify org.springframework.roo.support.util.WebXmlUtils.addFilterAtPosition to allow adding dispatcher tags to filter-mappings

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 1.1.0.RELEASE, 1.1.1.RELEASE, 1.1.2.RELEASE, 1.1.3.RELEASE, 1.2.0.RC1
    • Fix Version/s: 1.1.1.RELEASE
    • Component/s: @ CORE
    • Labels:
      None

      Description

      As a Roo Addon developer, I want an easy way to add dispatcher tags to filter-mappings.

      Please modify WebXmlUtils.addFilterAtPosition to allow this.

      Example:

      WebXmlUtils.addFilterAtPosition(WebXmlUtils.FilterPosition.AFTER, WebMvcOperations.OPEN_ENTITYMANAGER_IN_VIEW_FILTER_NAME, null, "myFilter", "org.myfilter.MyFilter", "/*", webXmlDoc, null, new WebXmlUtils.WebXmlParam("my-param", "value"), new WebXmlUtils.WebXmlDispatcher("FORWARD"), new WebXmlUtils.WebXmlDispatcher("REQUEST"), new WebXmlUtils.WebXmlDispatcher("ERROR"));

      would generate:

      <filter>
      <filter-name>myFilter</filter-name>
      <filter-class>org.myfilter.MyFilter</filter-class>
      <init-param>
      <param-name>my-param</param-name>
      <param-value>value</param-value>
      </init-param>
      </filter>
      <filter-mapping>
      <filter-name>sitemesh</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>ERROR</dispatcher>
      </filter-mapping>

        Activity

        Hide
        Scott Murphy added a comment -

        Just wanted to express that the dispatcher tag is valid web.xml markup in the 2.4 and 2.5 specifications.

        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

        The dispatcher has four legal values: FORWARD, REQUEST, INCLUDE,
        and ERROR. A value of FORWARD means the Filter will be applied
        under RequestDispatcher.forward() calls. A value of REQUEST
        means the Filter will be applied under ordinary client calls to
        the path or servlet. A value of INCLUDE means the Filter will be
        applied under RequestDispatcher.include() calls. A value of
        ERROR means the Filter will be applied under the error page
        mechanism. The absence of any dispatcher elements in a
        filter-mapping indicates a default of applying filters only under
        ordinary client calls to the path or servlet.

        Show
        Scott Murphy added a comment - Just wanted to express that the dispatcher tag is valid web.xml markup in the 2.4 and 2.5 specifications. http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd The dispatcher has four legal values: FORWARD, REQUEST, INCLUDE, and ERROR. A value of FORWARD means the Filter will be applied under RequestDispatcher.forward() calls. A value of REQUEST means the Filter will be applied under ordinary client calls to the path or servlet. A value of INCLUDE means the Filter will be applied under RequestDispatcher.include() calls. A value of ERROR means the Filter will be applied under the error page mechanism. The absence of any dispatcher elements in a filter-mapping indicates a default of applying filters only under ordinary client calls to the path or servlet.
        Hide
        Stefan Schmidt added a comment -

        Complete with commit 64227c7b1a46b667126f981bf0ae7f1bc131e524. Also added WebXmlUtilsTests.

        Show
        Stefan Schmidt added a comment - Complete with commit 64227c7b1a46b667126f981bf0ae7f1bc131e524. Also added WebXmlUtilsTests.

          People

          • Assignee:
            Stefan Schmidt
            Reporter:
            Scott Murphy
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: