org.eclipse.jetty.jndi
类 ContextFactory

java.lang.Object
  继承者 org.eclipse.jetty.jndi.ContextFactory
所有已实现的接口:
ObjectFactory

public class ContextFactory
extends Object
implements ObjectFactory

ContextFactory.java This is an object factory that produces a jndi naming context based on a classloader. It is used for the java:comp context. This object factory is bound at java:comp. When a lookup arrives for java:comp, this object factory is invoked and will return a context specific to the caller's environment (so producing the java:comp/env specific to a webapp). The context selected is based on classloaders. First we try looking at the thread context classloader if it is set, and walk its hierarchy, creating a context if none is found. If the thread context classloader is not set, then we use the classloader associated with the current Context. If there is no current context, or no classloader, we return null. Created: Fri Jun 27 09:26:40 2003


构造方法摘要
ContextFactory()
           
 
方法摘要
static void dump(Appendable out, String indent)
           
 Context getContextForClassLoader(ClassLoader loader)
          Find the naming Context for the given classloader
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env)
          Find or create a context which pertains to a classloader.
 NamingContext newNamingContext(Object obj, ClassLoader loader, Hashtable env, Name name, Context parentCtx)
          Create a new NamingContext.
static void resetComponentContext(Context ctx)
          Set back the context with the given value.
static Context setComponentContext(Context ctx)
          Associate the given Context with the current thread.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ContextFactory

public ContextFactory()
方法详细信息

getObjectInstance

public Object getObjectInstance(Object obj,
                                Name name,
                                Context nameCtx,
                                Hashtable env)
                         throws Exception
Find or create a context which pertains to a classloader. If the thread context classloader is set, we try to find an already-created naming context for it. If one does not exist, we walk its classloader hierarchy until one is found, or we run out of parent classloaders. In the latter case, we will create a new naming context associated with the original thread context classloader. If the thread context classloader is not set, we obtain the classloader from the current jetty Context, and look for an already-created naming context. If there is no current jetty Context, or it has no associated classloader, we return null.

指定者:
接口 ObjectFactory 中的 getObjectInstance
抛出:
Exception
另请参见:
ObjectFactory.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)

newNamingContext

public NamingContext newNamingContext(Object obj,
                                      ClassLoader loader,
                                      Hashtable env,
                                      Name name,
                                      Context parentCtx)
                               throws Exception
Create a new NamingContext.

参数:
obj -
loader -
env -
name -
parentCtx -
返回:
抛出:
Exception

getContextForClassLoader

public Context getContextForClassLoader(ClassLoader loader)
Find the naming Context for the given classloader

参数:
loader -
返回:

setComponentContext

public static Context setComponentContext(Context ctx)
Associate the given Context with the current thread. resetComponentContext method should be called to reset the context.

参数:
ctx - the context to associate to the current thread.
返回:
the previous context associated on the thread (can be null)

resetComponentContext

public static void resetComponentContext(Context ctx)
Set back the context with the given value. Don't return the previous context, use setComponentContext() method for this.

参数:
ctx - the context to associate to the current thread.

dump

public static void dump(Appendable out,
                        String indent)
                 throws IOException
抛出:
IOException


Copyright © 2013. All Rights Reserved.