Class ActionApiCall
java.lang.Object
gaiasky.util.urlprotocol.ActionApiCall
- All Implemented Interfaces:
ActionHandler
Generic reflective action handler that maps
gaiasky:// URLs to
APIv2 calls. The URL has the form:
gaiasky://<module>/<method>?param1=value1¶m2=value2...
For example:
gaiasky://camera/focus_mode?name=Earthgaiasky://time/set_time?year=2026&month=1&day=1
The method resolution and parameter coercion follow the same conventions as
the REST server (RESTServer.handleAPIv2Call()): parameters are
matched by name (or positionally as arg0, arg1, ...) and
coerced from strings to the method parameter types.
For security reasons, only modules that are not in the disallow list
(urlApiDisallowedModules) are
reachable. Individual methods can also be disallowed through
urlApiDisallowedMethods, using the
module.method format (e.g. camera.go_to_object).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisDisallowed(String module, String method) Checks whether the given module or method is disallowed by the hardcoded lists of this class.voidprocess(String url, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, boolean hotLoad, Map<String, String> params) Process the action.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ActionHandler
getParameterValue, postNotificationModifier and TypeMethodDescriptiondefault StringgetParameterValue(Map<String, String> params, String... names) default voidpostNotification(String message) Posts a popup notification.
-
Constructor Details
-
ActionApiCall
public ActionApiCall()
-
-
Method Details
-
process
public void process(String url, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, boolean hotLoad, Map<String, String> params) Description copied from interface:ActionHandlerProcess the action.- Specified by:
processin interfaceActionHandler- Parameters:
url- The URL string.skin- The UI skin.stage- The UI stage.hotLoad- Whether to hot load.params- The parameters.
-
isDisallowed
Checks whether the given module or method is disallowed by the hardcoded lists of this class. Additionally, methods that return a value are rejected after method resolution, seeprocess().- Parameters:
module- The module name.method- The method name. May be null (only the module is checked).- Returns:
- True if the call is disallowed.
-