Java 类org.apache.catalina.core.NamingContextListener 实例源码

项目:tomee    文件:OpenEJBContextConfig.java   
@Override
protected void contextConfig(final Digester digester) {
    final NamingResourcesImpl resources;
    if (context != null) {
        resources = context.getNamingResources();
    } else {
        resources = null;
    }

    if (resources instanceof OpenEJBNamingResource) {
        ((OpenEJBNamingResource) resources).setTomcatResource(true);
    }
    super.contextConfig(digester);
    if (resources instanceof OpenEJBNamingResource) {
        ((OpenEJBNamingResource) resources).setTomcatResource(false);
    }

    if (context instanceof StandardContext) {
        final StandardContext standardContext = (StandardContext) context;
        final NamingContextListener namingContextListener = standardContext.getNamingContextListener();
        if (null != namingContextListener) {
            namingContextListener.setExceptionOnFailedWrite(standardContext.getJndiExceptionOnFailedWrite());
        }
    }
}
项目:embed-apache-tomcat    文件:TomcatServerBuilderImpl.java   
private void enableJndi() {
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
    }

    this.enableNaming = true;
}
项目:tomcat7    文件:Tomcat.java   
/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link Lifecycle} in order for the {@link NamingContextListener} to be
 * used.
 * 
 */
public void enableNaming() {
    // Make sure getServer() has been called as that is where naming is
    // disabled
    getServer();
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty
            (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.naming.java.javaURLContextFactory");
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:Tomcat.java   
/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link Lifecycle} in order for the {@link NamingContextListener} to be
 * used.
 * 
 */
public void enableNaming() {
    // Make sure getServer() has been called as that is where naming is
    // disabled
    getServer();
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty
            (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.naming.java.javaURLContextFactory");
    }
}
项目:class-guard    文件:Tomcat.java   
/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link Lifecycle} in order for the {@link NamingContextListener} to be
 * used.
 * 
 */
public void enableNaming() {
    // Make sure getServer() has been called as that is where naming is
    // disabled
    getServer();
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty
            (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.naming.java.javaURLContextFactory");
    }
}
项目:apache-tomcat-7.0.57    文件:Tomcat.java   
/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link Lifecycle} in order for the {@link NamingContextListener} to be
 * used.
 * 
 */
public void enableNaming() {
    // Make sure getServer() has been called as that is where naming is
    // disabled
    getServer();
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty
            (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.naming.java.javaURLContextFactory");
    }
}
项目:apache-tomcat-7.0.57    文件:Tomcat.java   
/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link Lifecycle} in order for the {@link NamingContextListener} to be
 * used.
 * 
 */
public void enableNaming() {
    // Make sure getServer() has been called as that is where naming is
    // disabled
    getServer();
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty
            (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.naming.java.javaURLContextFactory");
    }
}
项目:WBSAirback    文件:Tomcat.java   
/**
 * Enables JNDI naming which is disabled by default. Server must implement
 * {@link Lifecycle} in order for the {@link NamingContextListener} to be
 * used.
 * 
 */
public void enableNaming() {
    // Make sure getServer() has been called as that is where naming is
    // disabled
    getServer();
    server.addLifecycleListener(new NamingContextListener());

    System.setProperty("catalina.useNaming", "true");

    String value = "org.apache.naming";
    String oldValue =
        System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
    if (oldValue != null) {
        if (oldValue.contains(value)) {
            value = oldValue;
        } else {
            value = value + ":" + oldValue;
        }
    }
    System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);

    value = System.getProperty
        (javax.naming.Context.INITIAL_CONTEXT_FACTORY);
    if (value == null) {
        System.setProperty
            (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.naming.java.javaURLContextFactory");
    }
}