The REST API cartridge exposes a ForgeRestApiExtension interface that is used to register new REST APIs. The cartridge that defines the custom REST API must have a dependency on the Forge-RestAPI cartridge for the extension interface to be visible. The cartridge should then define a Java class that implements the interface, and provides a reference to the JAX-RS resource class. The following is an example of a custom ForgeRestApiExtension class for a specific resource class:
The cartridge should define a lifecycle class that implements both the LifecycleAware and ExtensionContextAware interfaces. This class should be configured to instantiate with the cartridge deployment, enabling it to receive cartridge lifecycle events.
NOTE: The /*Hint: ...*/ comment must appear as the first line on the script in order for it to be processed correctly on the FMS. The script will also need to be run in the context of the Forge-RestAPI cartridge to allow the extension interface classes to be resolved. |
Any REST APIs registered with this approach will remain registered until the Foglight Management Server shuts down. The script will need to be re-run when the server is restarted. If the scripts are packaged in a cartridge, it would be possible to use a class that implements the LifecycleAware interface to run the script from the start() method.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. 使用条款 隐私 Cookie Preference Center