How Groovy custom policies work?
Custom policies work by providing a means for the policy to incorporate some Groovy code that is then executed by the gateway. The Groovy policies have the means to interact with the gateway engine through some language interface classes. The use of Groovy is also subject to some constraints due to the way that the language is optimized for runtime. In the following sections, the interface layer and then constraints will be explained and illustrated with a real example.
APIs to access call data
For the Groovy policies to be of value, they obviously need to be able to access the information relating to the API call. This is solved by providing several java interfaces that can be invoked by Groovy without needing an import statement. These APIs are common to both the Groovy approach and the Java approach for building the API policies.
The following table describes the roles of the key interfaces and classes and how they can be used:
Class/Interface | Description |
Interface... |