The first step to create a custom Java interceptor is to create a new Java project.
Here, we'll create a Maven project.
Inside it, we are going to configure and install the dependency interceptor-java-spec, which can be downloaded on this page.
IMPORTANTCan I upload any external library?
No, but you can use any lib among the dependencies the API gateway supports. You can see the list of supported dependencies here.
This is an example of a pom.xml from one of the GitHub repositories with Custom Java examples.
NOTEThe dependency
interceptor-java-specmust be inside the foldersrc/main/resources, and its version must be informed in the filepom.xmlwith the tag<interceptor-java-spec.version>.
Install the dependency with the following command:
With the project and dependencies configured, the interceptors can be coded and compiled. This is an example:
Once the interceptor is coded, we can compile it, upload it to the API Platform and then start using it on API flows.
To compile the interceptor into a .jar file, you can use the following command:
After the command runs, a .jar file will be generated inside the /target folder.
Then, you can upload the interceptor to the Platform and start using it.

We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more