Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all articles
Browse latest Browse all 1091

Get application context root through JNDI

$
0
0

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


Viewing all articles
Browse latest Browse all 1091

Trending Articles