Configuring Mediation Rules

User can prepare their own Mediation rules to apply on HTTP Request and Response. Refer to the following sample rules to create new Mediation Rules.

HTTP Request Header Manipulation Rule

Following is a sample HTTP request header manipulation rule.

rule "Http-Req-Header-Manipulation-Rule"
    salience 20
when
    m : IWFHttpRequest(getUri() matches "http://xyz.com")
then
    m.header(m.ADD,"Header-Name","Value")
    m.header(m.UPDATE,"Header-Name","Value")
    m.header(m.DEL,"Header-Name")
end

HTTP Request Body Manipulation Rule

Following is a sample HTTP request body manipulation rule.

rule "Http-Req-Body-Manipulation_Rule"
        salience 20
when
        m : IWFHttpRequest(body("Attribute-Name") == "Value")
then
        m.body(m.ADD, "Attribute-Name", "Value")
        m.body(m.UPDATE, "Attribute-Name", "Value")
        m.body(m.DEL,"Attribute-Name", "Value")    
end

HTTP Response Header Manipulation Rule

Following is a sample HTTP response header manipulation rule.

rule "Http-Res-Header-Manipulation-Rule"
    salience 20
when
    m : IWFHttpResponse(header("Header-Name") == "Value")
then
    m.header(m.ADD,"Header-Name","Value")
    m.header(m.UPDATE,"Header-Name","Value")
    m.header(m.DEL,"Header-Name")
end

HTTP Response Body Manipulation Rule

Following is a sample HTTP response body manipulation rule.

rule "Http-Res-Body-Manipulation_Rule"
        salience 20
when
        m : IWFHttpResponse(body("Attribute-Name") == "Value")
then
        m.body(m.ADD, "Attribute-Name", "Value")
        m.body(m.UPDATE, "Attribute-Name", "Value")
        m.body(m.DEL,"Attribute-Name", "Value")    
end