application.getServerURL() in WAR deployment

Questions and Answers on installation, deployment, management, locking, tranasactions of Servoy Application Server

application.getServerURL() in WAR deployment

Postby Ruben79 » Mon Dec 07, 2015 5:36 pm

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?
Ruben de Jong
Stb Software Development
SAN Partner

Stb Software Development - http://www.stb.nl
User avatar
Ruben79
 
Posts: 97
Joined: Wed Apr 18, 2007 12:43 pm

Re: application.getServerURL() in WAR deployment

Postby Harjo » Wed Dec 09, 2015 11:05 am

and does the same code work in web-client on a war server? or is it purely the headless-client on a war server?
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: application.getServerURL() in WAR deployment

Postby jcompagner » Thu Jan 21, 2016 2:51 pm

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.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 8 guests