javaURLContextFactory.javaAPI DocApache Tomcat 6.0.143779Fri Jul 20 04:20:32 BST


public class javaURLContextFactory extends Object implements ObjectFactory, InitialContextFactory
Context factory for the "java:" namespace.

Important note : This factory MUST be associated with the "java" URL prefix, which can be done by either :

  • Adding a java.naming.factory.url.pkgs=org.apache.catalina.util.naming property to the JNDI properties file
  • Setting an environment variable named Context.URL_PKG_PREFIXES with its value including the org.apache.catalina.util.naming package name. More detail about this can be found in the JNDI documentation : {@link javax.naming.spi.NamingManager#getURLContext(java.lang.String, java.util.Hashtable)}.
Remy Maucherat
$Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
public static final String
protected static Context
Initial context.
Constructors Summary
Methods Summary
public javax.naming.ContextgetInitialContext(java.util.Hashtable environment)
Get a new (writable) initial context.

        if (ContextBindings.isThreadBound() || 
            (ContextBindings.isClassLoaderBound())) {
            // Redirect the request to the bound initial context
            return new SelectorContext(environment, true);
        } else {
            // If the thread is not bound, return a shared writable context
            if (initialContext == null)
                initialContext = new NamingContext(environment, MAIN);
            return initialContext;
public java.lang.ObjectgetObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)
Crete a new Context's instance.

    // --------------------------------------------------------- Public Methods

    // -------------------------------------------------- ObjectFactory Methods

        if ((ContextBindings.isThreadBound()) || 
            (ContextBindings.isClassLoaderBound())) {
            return new SelectorContext(environment);
        } else {
            return null;