Go to primary content
Oracle® Communications Inter-Working Function (IWF) Cloud Native User's Guide
Release 1.0
F16989-01
Go To Table Of Contents
Contents

Previous
Previous
Next
Next

Configuring Mediation Rules

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

HTTP Request Header Manipulation Rule

Following is an 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 an 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 an 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 an 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