Wildcard Filter in Mule
The Wildcard Filter applies a wildcard pattern to the message payload. The filter applies the toString() method to the payload to convert the payload to a String. To ensure that the payload is a String, you might want to apply a Payload Filter to the message with a nested And Logic Filter.
By default, pattern matching is case sensitive, and the Case Sensitive box is checked. Uncheck this box if you do not want pattern matching to be case sensitive.
Wildcard filter filters payload on the basis of wildcard expression that we gives in filter configuration.If input payload do not match with expression then input payload will not pass.
flow of Wildcard filter :
wildcard filter configuration :
URL : http://localhost:8085/api/wildfilter
Input :
Output :
XML project code :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" basePath="/api" doc:name="HTTP Listener Configuration"/>
<flow name="test_wildcardfilterFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/wildfilter" doc:name="HTTP">
<http:response-builder>
<http:header headerName="Access-Control-Allow-Origin" value="*"/>
</http:response-builder>
</http:listener>
<wildcard-filter pattern="*india" caseSensitive="true" doc:name="Wildcard"/>
</flow>
</mule>
No comments:
Post a Comment