Runtime components : Channels components : Key features : Concepts : Channel management : Channel policy management
  
Channel policy management
UNICOM® Digital Transformation Toolkit (UDTT™) policy management includes channel policy management and transaction policy management. Channel policy management controls the policy in the channel scope.
Policy Management provides channel policy handler to handle channel scope policy. And channel policy handler is invoked when any requests enter UDTT servers. To use the channel scope policy, you need:
1 Implement the AbstractChannelPolicy class. UDTT provides an abstract channel policy handler--- AbstractChannelPolicy, to handle the policy in the channel level. The docheck method in AbstractChannelPolicy provides a default implementation to use rule service to connect to the rule engine, and you can extend it according to your needs. Then implement the following two abstract methods:
getInputParameter, to construct the input parameters for docheck method using the data from the channel context or getting from data store;
processResult, to parse the result returned from rule engine;
The PolicyResult is the outcome of processResult method, which includes the execution result of policy check. If check pass, then continue the request processing, otherwise throwing exception. The messages in PolicyResult are used to keep the messages generated during rule check.
2 Configure the channel policy handler after you implement the AbstractChannelPolicy. Then configure the related channel in file btt.xml to use it. The format of configuration is as following:
<!-- html --><kColl
id="html">
<field id="cookies" value="true"/>
<field id="encoding" value="UTF-8"/>
<field id="runInSession" value="true"/>
<field id="requestHandler"
value="com.ibm.btt.cs.html.HtmlRequestHandler"/>
<field id="presentationHandler"
value="com.ibm.btt.poc.rule.channel.MyHtmlPresentationHandler"/>
<field id="channelPolicyHandler"
value="com.ibm.btt.poc.rule.channel.MyChannelPolicyHandler"/>
<field id="ruleService" value="javaCodeChannelRuleService"/>
</kColl>
The channelPolicyHandler field is the implementation of the abstract channel policy handler.
The ruleService value is the id of rule service.
Note If you configure the channel policy handler in HTML and Java Channel, it works for all requests; but for XML channel, you need to create session in a servlet (For example, the com.ibm.btt.xml.servlet.CreateSession servlet in BTTMultiChannelSample), and channel policy handler does not work on the servlet.
Go up to
Channel management