+

Search Tips   |   Advanced Search

Create and delete configuration settings of the outbound HTTP connection

The controller object also provides methods for creating or deleting configuration settings.

We can create new items using the CreationContext interface. This interface provides the controller with the mandatory initialization data. The following creation contexts are available: OutboundConnectionProfileCreationContext, PolicyMappingCreationContext, PolicyRuleCreationContext, CookieRuleCreationContext, and PolicyVariableCreationContext. We can implement the creation contexts either by a custom application or by the singleton class OutboundConnectionCreationContextBuidlerFactory.

The following code example shows how we create a new policy rule, and how you delete another policy rule:

OutboundConnectionModel model;  // Refer to previous examples, how to instantiate this model.  // Refer to previous example, how to instantiate this.
OutboundConnectionModelController ctrl;  PolicyRule rule;// Refer to previous examples, how to instantiate this policy rule.
 // This singleton can be used to produce CreationContext objects.
OutboundConnectionCreationContextBuilderFactory ccf =       OutboundConnectionCreationContextBuilderFactory.getInstance();
 // Create a new policy rule.
CreationContext cc = ccf.getPolicyRuleCreationContext(mapping, "rule2", "www.testme.com/test2*");
ModifiablePolicyRule mrule2 = (ModifiablePolicyRule) ctrl.create(ModifiablePolicyRule.class, cc);
 // Delete the policy rule.
ctrl.delete(rule);
 // Apply the changes.
ctrl.commit();  


Parent Configure outbound HTTP connections using the Model Controller SPI

Previous topic: Modify configuration settings of the outbound HTTP connection