SelectorContext (Apache Tomcat 11.0.21 API Documentation)
Description: declaration: package: org.apache.naming, class: SelectorContext

# Class SelectorContext

java.lang.Object
org.apache.naming.SelectorContext

All Implemented Interfaces:
  `Context`

public class SelectorContext extends Object implements Context
Catalina JNDI Context implementation.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Hashtable<String,Object>`
  `env`
  Environment.
  `static final String`
  `IC_PREFIX`
  Initial context prefix.
  `protected final boolean`
  `initialContext`
  Request for an initial context.
  `static final String`
  `prefix`
  Namespace URL.
  `static final int`
  `prefixLength`
  Namespace URL length.
  `protected static final StringManager`
  `sm`
  The string manager for this package.

  ### Fields inherited from interface Context

  `AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SelectorContext(Hashtable<String,Object> env)`
  Builds a Catalina selector context using the given environment.
  `SelectorContext(Hashtable<String,Object> env, boolean initialContext)`
  Builds a Catalina selector context using the given environment.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `addToEnvironment(String propName, Object propVal)`
  `void`
  `bind(String name, Object obj)`
  `void`
  `bind(Name name, Object obj)`
  `void`
  `close()`
  `String`
  `composeName(String name, String prefix)`
  `Name`
  `composeName(Name name, Name prefix)`
  `Context`
  `createSubcontext(String name)`
  `Context`
  `createSubcontext(Name name)`
  `void`
  `destroySubcontext(String name)`
  `void`
  `destroySubcontext(Name name)`
  `protected Context`
  `getBoundContext()`
  Get the bound context.
  `Hashtable<?,?>`
  `getEnvironment()`
  `String`
  `getNameInNamespace()`
  `NameParser`
  `getNameParser(String name)`
  `NameParser`
  `getNameParser(Name name)`
  `NamingEnumeration<NameClassPair>`
  `list(String name)`
  `NamingEnumeration<NameClassPair>`
  `list(Name name)`
  `NamingEnumeration<Binding>`
  `listBindings(String name)`
  `NamingEnumeration<Binding>`
  `listBindings(Name name)`
  `Object`
  `lookup(String name)`
  `Object`
  `lookup(Name name)`
  `Object`
  `lookupLink(String name)`
  `Object`
  `lookupLink(Name name)`
  `protected String`
  `parseName(String name)`
  Strips the URL header.
  `protected Name`
  `parseName(Name name)`
  Strips the URL header.
  `void`
  `rebind(String name, Object obj)`
  `void`
  `rebind(Name name, Object obj)`
  `Object`
  `removeFromEnvironment(String propName)`
  `void`
  `rename(String oldName, String newName)`
  `void`
  `rename(Name oldName, Name newName)`
  `void`
  `unbind(String name)`
  `void`
  `unbind(Name name)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### prefix

    public static final String prefix
    Namespace URL.
    See Also:
      - Constant Field Values

  - ### prefixLength

    public static final int prefixLength
    Namespace URL length.

  - ### IC_PREFIX

    public static final String IC_PREFIX
    Initial context prefix.
    See Also:
      - Constant Field Values

  - ### env

    protected final Hashtable<String,Object> env
    Environment.

  - ### sm

    protected static final StringManager sm
    The string manager for this package.

  - ### initialContext

    protected final boolean initialContext
    Request for an initial context.

- ## Constructor Details

  - ### SelectorContext

    public SelectorContext(Hashtable<String,Object> env)
    Builds a Catalina selector context using the given environment.
    Parameters:
      `env` - The environment

  - ### SelectorContext

    public SelectorContext(Hashtable<String,Object> env, boolean initialContext)
    Builds a Catalina selector context using the given environment.
    Parameters:
      `env` - The environment
      `initialContext` - `true` if this is the main initial context

- ## Method Details

  - ### lookup

    public Object lookup(Name name) throws NamingException
    Specified by:
      `lookup` in interface `Context`
    Throws:
      `NamingException`

  - ### lookup

    public Object lookup(String name) throws NamingException
    Specified by:
      `lookup` in interface `Context`
    Throws:
      `NamingException`

  - ### bind

    public void bind(Name name, Object obj) throws NamingException
    Specified by:
      `bind` in interface `Context`
    Throws:
      `NamingException`

  - ### bind

    public void bind(String name, Object obj) throws NamingException
    Specified by:
      `bind` in interface `Context`
    Throws:
      `NamingException`

  - ### rebind

    public void rebind(Name name, Object obj) throws NamingException
    Specified by:
      `rebind` in interface `Context`
    Throws:
      `NamingException`

  - ### rebind

    public void rebind(String name, Object obj) throws NamingException
    Specified by:
      `rebind` in interface `Context`
    Throws:
      `NamingException`

  - ### unbind

    public void unbind(Name name) throws NamingException
    Specified by:
      `unbind` in interface `Context`
    Throws:
      `NamingException`

  - ### unbind

    public void unbind(String name) throws NamingException
    Specified by:
      `unbind` in interface `Context`
    Throws:
      `NamingException`

  - ### rename

    public void rename(Name oldName, Name newName) throws NamingException
    Specified by:
      `rename` in interface `Context`
    Throws:
      `NamingException`

  - ### rename

    public void rename(String oldName, String newName) throws NamingException
    Specified by:
      `rename` in interface `Context`
    Throws:
      `NamingException`

  - ### list

    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
    Specified by:
      `list` in interface `Context`
    Throws:
      `NamingException`

  - ### list

    public NamingEnumeration<NameClassPair> list(String name) throws NamingException
    Specified by:
      `list` in interface `Context`
    Throws:
      `NamingException`

  - ### listBindings

    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
    Specified by:
      `listBindings` in interface `Context`
    Throws:
      `NamingException`

  - ### listBindings

    public NamingEnumeration<Binding> listBindings(String name) throws NamingException
    Specified by:
      `listBindings` in interface `Context`
    Throws:
      `NamingException`

  - ### destroySubcontext

    public void destroySubcontext(Name name) throws NamingException
    Specified by:
      `destroySubcontext` in interface `Context`
    Throws:
      `NamingException`

  - ### destroySubcontext

    public void destroySubcontext(String name) throws NamingException
    Specified by:
      `destroySubcontext` in interface `Context`
    Throws:
      `NamingException`

  - ### createSubcontext

    public Context createSubcontext(Name name) throws NamingException
    Specified by:
      `createSubcontext` in interface `Context`
    Throws:
      `NamingException`

  - ### createSubcontext

    public Context createSubcontext(String name) throws NamingException
    Specified by:
      `createSubcontext` in interface `Context`
    Throws:
      `NamingException`

  - ### lookupLink

    public Object lookupLink(Name name) throws NamingException
    Specified by:
      `lookupLink` in interface `Context`
    Throws:
      `NamingException`

  - ### lookupLink

    public Object lookupLink(String name) throws NamingException
    Specified by:
      `lookupLink` in interface `Context`
    Throws:
      `NamingException`

  - ### getNameParser

    public NameParser getNameParser(Name name) throws NamingException
    Specified by:
      `getNameParser` in interface `Context`
    Throws:
      `NamingException`

  - ### getNameParser

    public NameParser getNameParser(String name) throws NamingException
    Specified by:
      `getNameParser` in interface `Context`
    Throws:
      `NamingException`

  - ### composeName

    public Name composeName(Name name, Name prefix) throws NamingException
    Specified by:
      `composeName` in interface `Context`
    Throws:
      `NamingException`

  - ### composeName

    public String composeName(String name, String prefix) throws NamingException
    Specified by:
      `composeName` in interface `Context`
    Throws:
      `NamingException`

  - ### addToEnvironment

    public Object addToEnvironment(String propName, Object propVal) throws NamingException
    Specified by:
      `addToEnvironment` in interface `Context`
    Throws:
      `NamingException`

  - ### removeFromEnvironment

    public Object removeFromEnvironment(String propName) throws NamingException
    Specified by:
      `removeFromEnvironment` in interface `Context`
    Throws:
      `NamingException`

  - ### getEnvironment

    public Hashtable<?,?> getEnvironment() throws NamingException
    Specified by:
      `getEnvironment` in interface `Context`
    Throws:
      `NamingException`

  - ### close

    public void close() throws NamingException
    Specified by:
      `close` in interface `Context`
    Throws:
      `NamingException`

  - ### getNameInNamespace

    public String getNameInNamespace() throws NamingException
    Specified by:
      `getNameInNamespace` in interface `Context`
    Throws:
      `NamingException`

  - ### getBoundContext

    protected Context getBoundContext() throws NamingException
    Get the bound context.
    Returns:
      the Context bound with either the current thread or the current classloader
    Throws:
      `NamingException` - Bindings exception

  - ### parseName

    protected String parseName(String name) throws NamingException
    Strips the URL header.
    Parameters:
      `name` - The name
    Returns:
      the parsed name
    Throws:
      `NamingException` - if there is no "java:" header or if no naming context has been bound to this thread

  - ### parseName

    protected Name parseName(Name name) throws NamingException
    Strips the URL header.
    Parameters:
      `name` - The name
    Returns:
      the parsed name
    Throws:
      `NamingException` - if there is no "java:" header or if no naming context has been bound to this thread