Thursday, September 5, 2013

Checking the non-existent of a property using WSO2 ESB 4.6

You can't simply do a string regex matching, if you are to check the non-existence of a property. What you could do is to leverage the boolean Xpath function [1], within a filter mediator.

Please see the following sample proxy configuration:

<proxy xmlns="" name="TEST" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
         <filter source="boolean(get-property('accept'))" regex="false">
               <log level="custom">
                  <property name="*********" value="NULL Property Value"/>
               <log level="custom">
                  <property name="*********" value="NOT NULL Property Value"/>

Hope this will save some amount of time of quite a bit of you :-)



Anonymous said...

This is really useful. Thank you for the blog post :)

Scott Bechtel said...

I had it as ... regex="'false'" (with ticks) Did NOT work! Must only be double quotes.

That was a waist of an hour because I didn't notice the difference here. LOL Thank you for this great post!!!! Still helping people.

Pan said...

Thank you. This has helped me.