Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-20356

[GSS](7.3.z) WFLY-13976 - Undertow subsystem <filter-ref> does not resolve property expression for the predicate attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.3.4.CR1, 7.3.4.GA
    • 7.3.3.CR1
    • Undertow
    • None
    • False
    • False
    • +
    • Undefined
    • Workaround Exists
    • Hide

      Use <expresion-filter> and specify predicate inside the "expression" instead of using "predicate" of <filter-ref>. For example:

      <expression-filter name="dump-request-filter" expression="path-prefix('/${my.predicate.path.test}') -> dump-request"/>
      

      I think this workaround can be used in most cases. However, we can not use <expression-filter> in some cases. For example, the "request-limit" expression does not support all configurable parameters that the <request-limit> filter supports. (e.g. queue-size can not be specified to the "request-limit" expression.) So, we can not configure the exact same setting with <expression-filter>.

      Show
      Use <expresion-filter> and specify predicate inside the "expression" instead of using "predicate" of <filter-ref>. For example: <expression-filter name= "dump-request-filter" expression= "path-prefix( '/${my.predicate.path.test}' ) -> dump-request" /> I think this workaround can be used in most cases. However, we can not use <expression-filter> in some cases. For example, the "request-limit" expression does not support all configurable parameters that the <request-limit> filter supports. (e.g. queue-size can not be specified to the "request-limit" expression.) So, we can not configure the exact same setting with <expression-filter>.

      Undertow subsystem supports the property expression for the "predicate" attribute of <filter-ref> as shown below in the resource description. However, it does not resolve and expand the specified property expression.

      [standalone@node1:9990 /] /subsystem=undertow/server=default-server/host=default-host/filter-ref=*:read-resource-description(recursive=true)
      {
          ...
              "result" => {
                  "description" => "Reference to filter",
                  "attributes" => {
                      "predicate" => {
                          "type" => STRING,
                          "description" => "Predicates provide a simple way of making a true/false decision  based on an exchange. Many handlers have a requirement 
      that they be applied conditionally, and predicates provide a general way to specify a condition.",
                          "expressions-allowed" => true,
                          "required" => false,
                          "nillable" => true,
                          "access-type" => "read-write",
                          "storage" => "configuration",
                          "restart-required" => "all-services"
                      },
                      "priority" => {
                          "type" => INT,
                          "description" => "Defines filter order. A lower number instructs the server to be included earlier in the handler chain than others with h
      igher numbers. Values range from 1, indicating the filter will be handled first, to 2147483647, resulting in the filter being handled last.",
                          "expressions-allowed" => true,
                          "required" => false,
                          "nillable" => true,
                          "default" => 1,
                          "min" => 1L,
                          "max" => 2147483647L,
                          "access-type" => "read-write",
                          "storage" => "configuration",
                          "restart-required" => "all-services"
                      }
                  },
                  "operations" => undefined,
                  "notifications" => undefined,
                  "children" => {}
              }
          }]
      }
      

      Example configuration:

        <subsystem xmlns="urn:jboss:domain:undertow:10.0" ...>
            ...
            <server name="default-server">
                ...
                <host name="default-host" alias="localhost">
                    ...
                    <filter-ref name="request-limit-filter" predicate="not path-prefix('/${env.FOOBAR}')"/>
                    <filter-ref name="dump-request-filter" predicate="path-prefix('/${my.predicate.path.test}')"/>
                </host>
            </server>
            ...
            <filters>
                <request-limit name="request-limit-filter" max-concurrent-requests="10" queue-size="1"/>
                <expression-filter name="dump-request-filter" expression="dump-request"/>
            </filters>
        </subsystem>
      

      Then, start EAP 7 with specifying the system property and environment variable:

      FOOBAR=example ./bin/standalone.sh -Dmy.predicate.path.test=test
      

              rhn-support-ivassile Ilia Vassilev
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: