Get the absolute location of the Tomcat context?

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Get the absolute location of the Tomcat context?

Postby steve1376656734 » Mon Sep 26, 2016 12:31 pm

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
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 327
Joined: Fri Aug 16, 2013 2:38 pm
Location: Ashford, UK

Re: Get the absolute location of the Tomcat context?

Postby ROCLASI » Mon Oct 03, 2016 10:53 am

Hi Steve,

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


Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 11 guests