星期三, 三月 03, 2004

如何得到jboss-web.xml定义的element的值.

JBoss :: Professional Open Source
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:
Code:


InitialContext ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
LinkRef ref = (LinkRef) envCtx.lookupLink("security/security-domain");
String secDomain = ref.getLinkName();