The following sample demonstrate how to encode a string in WSO2 ESB and how to check whether a string is encoded or not.
This is based on the regular expression given here to check whether a string is encoded or not.
<property name="string" value="abcd"/> <property name="encodedString" expression="base64Encode('abcd')"/> <log level="custom"> <property name="encodedString" expression="get-property('encodedString')"/> </log> <filter source="get-property('encodedString')" regex="^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"> <then> <log level="custom"> <property name="encoded?" value="yes"/> </log> </then> <else> <log level="custom"> <property name="encoded?" value="no"/> </log> </else> </filter>
This is based on the regular expression given here to check whether a string is encoded or not.
No comments:
Post a Comment