users@glassfish.java.net

Get application context root through JNDI

From: <forums_at_java.net>
Date: Sat, 1 Dec 2012 09:17:21 -0600 (CST)

Hi, Is there a way to get the context-root of the currently running
application at runtime? The name of the application is no problem: String
appName = (String)InitialContext.doLookup("java:app/AppName") Likewise, I
tried: String appContextRoot =
(String)InitialContext.doLookup("java:app/ContextRoot") but no dice. When I
look at the application details in the admin panel, I see a number of
"properties":
Name Status Virtual server Context root Description Location Libraries
Modules

I would expect that all these properties can be queried, but so far I only
succeeded in getting the Name of the application. Is it possible to get to
the others as well? I need to retrieve the context-root from a static method,
so I cannot use HttpRequest. Cheers, sohan Glassfish 3.1.2 JDK 1.7

--
[Message sent by forum member 'sohan']
View Post: http://forums.java.net/node/892853