How to check if app is running on Tomcat 7 embedded?

1.5k Views Asked by At

I have a application that runs as war or in standalone mode with tomcat embedded, I want to check if the application is running as a war within tomcat or if it is running with tomcat embedded.

1

There are 1 best solutions below

0
Henrique Luiz On BEST ANSWER

This is my solution.

String path = getClass().getProtectionDomain().getCodeSource().getLocation().getFile();
boolean onWar = path.contains("WEB-INF");