This is an old revision of the document!
Table of Contents
HTTP server user guide
It is possible to start GroIMP as a HTTP server to then send model paths via HTTP for GroIMP to execute. After GroIMP executed the model values can be returned to the HTTP client who send the request. It is possible to send several models in series or in parallel.
Execution
The HTTP server is part of every GroIMP release and can be executed as an command through the GUI or as a headless command.
GUI
In the main GroIMP menu under the section Net, the entry Open HTTP Server can be found. This will lead to a popup requesting the port number of the server (for more information about the port see below). After a port was given (usually the default one is fine) a new workbench with only the Messages panel is opened. The server now runs until this workbench is closed.
Headless
The GroIMP headless interface allows the execution of specific commands without starting the GUI by using the -cmd command.
In the case of the http server this command is as following:
java -jar core.jar --headless -- -cmd "/http/server=58080"
The name core.jar can variate debending on the way GroIMP was installed. “58080” is in this case the port, which can be changed if needed.
Commands
To interact with a running HTTP server currently only two commands are available. The URL schema is:
http://<serverIP>:<port>/<command>?<value>
In most cases the start will be:
http://localhost:58080/<command>?<value>
About
http://localhost:58080/about
This command returns the current version of the installed plugins and the list of the available HTTP commands.
Open
http://localhost:58080/open?<path/to/your/model.gsz>
This command will open the model provided as a value and execute the startup function. After the execution is done the request is returned and if configured the response value is given to the client. It is important to notice that the path is interpreted starting at the root directory given in the options.
Options
There are two options for the HTTP server that can be configured using the preferences under HTTP Server.
Root directory
In the subsection Open Project the root directory can be defined. This option defines where the server starts looking up the path given in the open command. By default this should be the home directory of the user.
Port
In the subsection Open HTTP server the default port which is suggested by the gui dialog can be defined. This might be useful for a setup where the original default port is often occupied.
Port
A port on a computer is used to define which application is actually meant by a network request. This is very useful to run several applications are using network protocols at the same time. For this to work the port needs to be unique, meaning no two applications can “listen” to the same port at the same time. Therefore in GroIMP it is possible to define which port is suppose to be used, for the case that an other application is already using the default one. Or for the scenario of running two GroIMP http server at the same time.