AndreaNobili
AndreaNobili

Reputation: 43037

Why in a filter mediator I can't check if the value of a property is less or equal to a specific value? Syntax error when I save

I am very new in WSO2 ESB and I am facing with this stange problem related a simple task: check if a property (having a numeric value) is less or equal a number.

Checking if it is equal I have no problem and it works fine:

<property expression="$trp:X-Rate-Limit-Remaining" name="X-Rate-Limit-Remaining-Value" scope="default" type="STRING"/>

<filter xpath="get-property('X-Rate-Limit-Remaining-Value')=1">
    <then>
        <log description="GLIS_WAIT" level="custom" separator="-">
            <property name="GLIS_WAIT" value="'WAIT'"/>
        </log>
    </then>
    <else>
        <log description="GLIS_NO_WAIT" level="custom" separator="-">
            <property name="GLIS_NO_WAIT" value="'NO WAIT'"/>
        </log>
    </else>
</filter>

But if I try to check if this property is less or equal the number 1, in this way:

<filter xpath="get-property('X-Rate-Limit-Remaining-Value')<=1">

When I save Eclipse give me a syntax error:

enter image description here

Clicking on the "Show Details" button I obtain:

enter image description here

(if I save anyway I obtain an error when the application is deployed on Carbon)

So it seems that the problem is related the < character, maybe it is interpreted as an tag opening and maybe I have to escape it in some way...

I don't know. I think that check if the property value is less or equal a specific value should do a simple task but I can't do it.

What is wrong in my code? What am I missing? How can I fix it?

Upvotes: 0

Views: 1524

Answers (1)

Jean-Michel
Jean-Michel

Reputation: 5946

You just have to replace < with &lt; or '<=' with &le;

Upvotes: 2

Related Questions