@Override
            public void write(IApimanBuffer chunk) {
                try {
                    String chunkstr = chunk.toString("UTF-8");
                    if (chunkstr.contains("$NAME")) {
                        chunkstr = chunkstr.replaceAll("\\$NAME", "Barry Allen");
                        IBufferFactoryComponent bufferFactory = context.<IBufferFactoryComponent>getComponent(IBufferFactoryComponent.class);

                        super.write(bufferFactory.createBuffer(chunkstr));
                    } else {
                        super.write(chunk);
                    }
                } catch (UnsupportedEncodingException e) {
                    super.write(chunk);
                }
            }
@see io.apiman.gateway.engine.policy.IDataPolicy#getRequestDataHandler(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object)
gateway/test/src/test/java/io/apiman/gateway/test/policies/SimpleDataPolicy.java