Here's the scenario.
My Java web application has following path
https://www.mywebsite.com:9443/MyWebApp
Let's say there is a JSP file
https://www.mywebsite.com:9443/MyWebApp/protected/index.jsp
and I need to retrieve
https://www.mywebsite.com:9443/MyWebApp
within this JSP file.
Of course, there is rather a lazy and silly way of just getting the URL and then re-tracing the path back.
But is there a programatic way of doing this? Specifically, I think I can get the domain + port, but how do I actually retrieve the application name "MyWebApp"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…