Class RESTServer
java.lang.Object
gaiasky.rest.RESTServer
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Implements the REST server, which serves the APIS (
APIv2 and IScriptingInterface) over HTTP(s).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the server to start serving requests.voiddispose()Stops the REST server gracefully.intgetPort()Returns the port the REST server listens to, if it is online.voidinitialize(boolean enabled, Integer restPort) Initialize the REST server.booleanChecks if the REST server is running.
-
Constructor Details
-
RESTServer
public RESTServer(boolean enabled, int port)
-
-
Method Details
-
initialize
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:
disposein interfacecom.badlogic.gdx.utils.Disposable
-