Page 1 of 1

Get the absolute location of the Tomcat context?

PostPosted: Mon Sep 26, 2016 12:31 pm
by steve1376656734
Hi,

I am trying to get the location on the server of the Tomcat context that the Servoy server is running on. I have tried to use the UserManager plugin (plugins.UserManager.Server().servoyDirectory) but on Linux (not sure for other platforms) this just returns the {TOMCAT_USER_HOME}/.servoy/server/{TOMCAT_CONTEXT} directory which in my case is /opt/tomcat/.servoy/server/V8Server. The actual location of the tomcat instance is /opt/tomcat/apache-tomcat-8.0.33/webapps/V8Server. I know it would be possible to construct the actual location using the UserManager info, extracting the context info and appending to the known location of the tomcat installation but I am looking to find a generic way of achieving this so that if the version of the tomcat server changes then I do not have to modify the code.

Can anyone help by suggesting the best way to do this?

Thanks
Steve

Re: Get the absolute location of the Tomcat context?

PostPosted: Mon Oct 03, 2016 10:53 am
by ROCLASI
Hi Steve,

Try this:
Code: Select all
application.output(Packages.java.lang.System.getProperty("catalina.base"));


Hope this helps.