2 Replies Latest reply on Mar 3, 2004 7:20 AM by sunose

    how to get jboss-web.xml element value?

    sunose

      hi:
      I am use JAAS to authenticate user,and now I want to get defined in jboss-web.xml file <security-domain>my</security-domain> value 'my' in servlet.

      how to get this value?


      thanks


      Regards

      William Wang

        • 1. Re: how to get jboss-web.xml element value?
          starksm64

          There is a link to the web security manager under the name "java:comp/env/security/security-domain". If you want the security manager you can look it up:

          import org.jboss.security.SubjectSecurityManager;
          
           InitialContext ctx = new InitialContext();
           Context envCtx = (Context) ctx.lookup("java:comp/env");
           SubjectSecurityManager ssm = (SubjectSecurityManager) envCtx.lookup("security/security-domain");
          


          If you just want the name, use:
          
           InitialContext ctx = new InitialContext();
           Context envCtx = (Context) ctx.lookup("java:comp/env");
           LinkRef ref = (LinkRef) envCtx.lookupLink("security/security-domain");
           String secDomain = ref.getLinkName();
          




          • 2. Re: how to get jboss-web.xml element value?
            sunose

            Scott:

            Thank you.you free me.:)

            now the JAAS login code no hardcode.