String realmName=((SecurityHandler)getJBossWebApplicationContext().getChildHandlerByClass(SecurityHandler.class)).getUserRealm().getName();
        protected void initWebXmlElement(String element,org.mortbay.xml.XmlParser.Node node) throws Exception        {            // this is ugly - should be dispatched through a hash-table or introspection...            // these are handled by AbstractWebContainer            if("resource-ref".equals(element)||"resource-env-ref".equals(element)||"env-entry".equals(element)                    ||"ejb-ref".equals(element)||"ejb-local-ref".equals(element)||"security-domain".equals(element))            {                //_log.info("Don't moan : "+element);            }            else if("distributable".equals(element))            {                getJBossWebApplicationContext().setDistributable(true);            }            else if("login-config".equals(element))            {                // get Jetty to parse the realm-name element                super.initWebXmlElement(element,node);                                 // if the realm-name element is set in web.xml use it as the realm name                 // otherwise, use the security domain name from jboss-web.xml                                String realmName=((SecurityHandler)getJBossWebApplicationContext().getChildHandlerByClass(SecurityHandler.class)).getUserRealm().getName();                if (null==realmName)                {                    WebMetaData metaData = getJBossWebApplicationContext()._webApp.getMetaData();                    realmName = metaData.getSecurityDomain();                    if (null!=realmName)                    {                        if (realmName.endsWith("/"))                            realmName = realmName.substring (0, realmName.length());                        int idx = realmName.lastIndexOf('/');                        if (idx >= 0)                            realmName = realmName.substring(idx+1);                    }                }                                if(__log.isDebugEnabled())                    __log.debug("setting Realm: "+realmName);                getJBossWebApplicationContext()._realm=new JBossUserRealm(realmName,getJBossWebApplicationContext()._subjAttrName); // we                                                                                                                                // init()                                                                                                                                // it                                                                                                                                // later                ((SecurityHandler)getJBossWebApplicationContext().getChildHandlerByClass(SecurityHandler.class)).setUserRealm(getJBossWebApplicationContext()._realm); // cache and reuse ? - TODO            }            // these are handled by Jetty            else                super.initWebXmlElement(element,node);        }