Class ContextFactory

java.lang.Object
org.eclipse.jetty.jndi.ContextFactory
All Implemented Interfaces:
ObjectFactory

public class ContextFactory extends Object implements ObjectFactory
ContextFactory

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.