tags:

views:

22

answers:

1

Hi, How can I get the deployed war file name inside jboss. For example, when I am inside a servlet and I want to know the which war file name that I am in.

Thanks,

Son Nguyen

+1  A: 
String warName = new File(getServletContext().getRealPath("/")).getName();
Bozho
[Deja vu](http://stackoverflow.com/questions/2417949/getcontextpath-using-servlet/3896115#3896115) :)
BalusC
@BalusC - haha, yes.. in fact it's more interesting - I needed that piece of code the other day for a strange usecase (had to browse an unextracted war), so I copied it from your answer. Then I copied it here from my code :D
Bozho