I have developed an API in Eclipse deployed on Apache Tomcat Server which modifies an XML file kept in the ROOT folder of the server.
Apache Tomcat is installed in the D drive in my system and hence I've hard-coded that path in the API like this
new File("D:\\Program Files\\Apache Software Foundation\\Tomcat 7.0\\webapps\\ROOT\\example\\example.xml")
Also I've configured the server to use port 8080 hence I've also hard-coded the URI path in the API like this
String uriPath = "http://localhost:8080/example/example2";
And it works fine.
But now I want to deploy the same API in the form of a WAR file on different systems having Apache Tomcat.
How do I obtain the Apache Tomcat ROOT folder path and the port number for those systems programmatically so that one API works for all systems? How do I integrate that into the API?