Custom Java policies
As previously introduced, the API platform can support the development of custom Java API policies. The rest of this chapter will focus on this subject. There are many ways that this can be approached as a developer.
As the different aspects of build a policy are addressed, the steps that are recommended to be taken are identified.
Rather than including all the code for the custom Java policy in these pages, the source has been provided at https://github.com/APIPlatform-Book/GeoIPJavaPolicy.The rest of the section will include fragments of code to help illustrate and highlight specific details of the way custom policies work.
Composition of a custom Java policy
It is worth noting that all interfaces and how they relate to API calls apply equally to the Groovy policies as they do to the custom Java policies. This means understanding how Groovy works will provide a good foundation to understanding the Java approach.
As custom Java policies use the same basic framework that...