Mule ESB: Filter based on HTTP method -
i'm wondering if there way filter / route messages based on http method. i'm looking not process incoming requests have been posted options method. (this cross-origin resource share handling)
you can use mel(mule exression language - http://www.mulesoft.org/documentation/display/current/mule+expression+language+mel) query http.method param , choice router if want options request such send allowed methods so:
<choice doc:name="choice"> <when expression="#[message.inboundproperties['http.method'] == 'options']"> <http:response-builder status="200" doc:name="http response builder(200 - options)"> <http:header name="allow" value="get" /> <http:header name="content-type" value="#[null]" /> <set-payload value="#[null]" /> </http:response-builder> </when> <otherwise> <!-- else --> </oherwise> </choice> or can use expression filter if want drop message if not options:
<expression-filter expression="#[message.inboundproperties['http.method'] != 'options']" /> more info on routing , filtering here:
http://www.mulesoft.org/documentation/display/current/routing+message+processors
http://www.mulesoft.org/documentation/display/current/using+filters
Comments
Post a Comment