The documentation looks pretty good, even if there are some misleading paragraphs:
notequal Not equal to. (i.e. request value != condition value). Note, this operator only work with numeric rule types.and I've been able to set it up in a couple of minutes.
The next task was to create a redirecting rule for the case when a specific attribute is not present on the session or request. And the adventure started [smile/].
First of all, I haven't been able to see any good logs, and only after digging into the source code and setting the
logLevel init-param to LOG4J in the web.xml :
<init-param>
    <param-name>logLevel</param-name>
    <param-value>LOG4J</param-value>
</init-param>
I got the level of detail I needed. Now, the paragraph about conditions lists the possibility to use the
attribute and the session-attribute inside conditions, so I set up the following one:
<condition type="session-attribute" 
    name="myAttribute" 
    operator="equal" 
    next="and">???</condition>
with a big question in my head: how can I specify a null value?. Looking through the logs firstly, and than through the source code I have discovered that if the attribute is not present than the value considered inside the matching rule with be the "" (empty string). But, leaving the condition empty lead to a null matcher. It took me a while, to solve it, but here it is:  
<condition type="session-attribute" 
    name="myAttribute" 
    operator="equal" 
    next="and">^$</condition>
the trick being the condition value: ^$ (something that matches only empty values).I am not sure this is the correct way to set this rule, nor if it is the recommended way, but it was the single way I had UrlRewriteFilter behaving like I've expected.
No comments:
Post a Comment