application.getServerURL() in WAR deployment

Unfortunately, application.getServerURL() returns http://localhost:-1 when run from a headless client (rest_ws) in WAR deployment. So, no portnumber and no context.

I’m able to find out the context by using plugins.UserManager.Server().servoyDirectory, but then plugins.UserManager.Server().webServerPort gives me a -1.

I found some useful stuff in Packages.javax.servlet.http.HttpServletRequest (getLocalPort(), getRemotePort(), getContextPath()), but I don’t know how to access it from within Servoy (or if it is even possible)

Does anyone know a way to get the full path to the ‘base url’ of the server?

and does the same code work in web-client on a war server? or is it purely the headless-client on a war server?

Calling getServerURL for a headless client is currently pointless anyway
It will always return localhost:port and the port will be in a WAR deployment be -1 because we don’t really know it (or know it all the time)

A headless client can also be started through rmi by another client so there is no real http request doing this.
In your scenario in rest, there is a http request so it could be extracted from that but that is currently now being done.