tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Santos <ds7...@att.com>
Subject Getting StandardServer's NamingContext?
Date Tue, 21 Nov 2006 16:24:24 GMT

Is there a better way to get StandardServer's NamingContext than this?  I'm
writing a custom realm and I need some puggable resources (I'm using
GlobalNamingResources to configure these, it's the cleanest way I could come
up with)

// code is from a RealmBase-derived class start() method

Container c;
for(c = this.container; c.getParent() != null; c = c.getParent());

if(!(c instanceof Service)) {
    throw new SomeException("Can't find my Service, that's wierd.");
}

Service service = (Service)c;
StandardServer server = (StandardServer)service.getServer();
for(LifecycleListener ll : server.findLifecycleListeners()) {
    if(ll instanceof NamingContextListener) {
        rootNamingContext = ((NamingContextListener)ll).getNamingContext();
    }
}

Thanks,
Daniel

-- 
View this message in context: http://www.nabble.com/Getting-StandardServer%27s-NamingContext--tf2679812.html#a7474313
Sent from the Tomcat - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message