Java method for obtaining web container address
Tomcat local address e: \ soft4development \ apache-tomcat-6.0 eighteen
System. getProperty("user.dir")//E:\soft4develop\apache-tomcat-6.0. 18\bin System. getProperty("catalina.home")//E:\soft4develop\apache-tomcat-6.0. 18 the same applies to JBoss. Other containers were not tested.
Speaking of this, a friend happened to ask a question in the group
HTTP is required for login. After successful login, all other requests go to http
such as https://www.jb51.net/admin/user_manager.apsx
If you find that you don't need to go to HTTPS, forward it to
http://www.jb51.net/admin/user_manager.apsx
Here comes the problem
request. Getserverport() can only get port1 port at HTTPS
How to get port2 port.
The path to tomact can be obtained through the above method, and the path can be obtained through the following XML XPath
Tomcat server Port configuration splicing in XML.
Method of getting Tomcat port