Class RESTServer

java.lang.Object
gaiasky.rest.RESTServer
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class RESTServer extends Object implements com.badlogic.gdx.utils.Disposable
Implements the REST server, which serves the APIS (APIv2 and IScriptingInterface) over HTTP(s).
  • Constructor Details

    • RESTServer

      public RESTServer(boolean enabled, int port)
  • Method Details

    • initialize

      public void initialize(boolean enabled, Integer restPort)
      Initialize the REST server.

      Sets the routes and then passes the call to the handler.

      Parameters:
      restPort - The port to use for the REST server
    • activate

      public void activate()
      Activates the server to start serving requests.
    • isRunning

      public boolean isRunning()
      Checks if the REST server is running.
      Returns:
      True if the server is running.
    • getPort

      public int getPort()
      Returns the port the REST server listens to, if it is online. If it is offline, returns -1.
      Returns:
      The port.
    • dispose

      public void dispose()
      Stops the REST server gracefully.
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable