Class ActionApiCall

java.lang.Object
gaiasky.util.urlprotocol.ActionApiCall
All Implemented Interfaces:
ActionHandler

public class ActionApiCall extends Object implements ActionHandler
Generic reflective action handler that maps gaiasky:// URLs to APIv2 calls. The URL has the form:

gaiasky://<module>/<method>?param1=value1&param2=value2...

For example:

  • gaiasky://camera/focus_mode?name=Earth
  • gaiasky://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 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: ActionHandler
      Process the action.
      Specified by:
      process in interface ActionHandler
      Parameters:
      url - The URL string.
      skin - The UI skin.
      stage - The UI stage.
      hotLoad - Whether to hot load.
      params - The parameters.
    • isDisallowed

      public static boolean isDisallowed(String module, String method)
      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, see process().
      Parameters:
      module - The module name.
      method - The method name. May be null (only the module is checked).
      Returns:
      True if the call is disallowed.