Set the syntax used to parse name strings

JNDI clients which must interoperate with CORBA applications may need to use INS name syntax to represent names in string format. The name syntax property may be passed to the InitialContext constructor through its parameter, in the System properties, or in a file. The initial context and any contexts looked up from that initial context will parse name strings based on the specified syntax.

The following example shows how to set the name syntax to make the initial context parse name strings according to INS syntax.


Usage scenario

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import; // WebSphere naming constants

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "");
env.put(Context.PROVIDER_URL, ...);

Context initialContext = new InitialContext(env);

// The following name maps to a CORBA name component as follows...
//    id = "", kind = "in.INS.format"
// The unescaped dot is used as the delimiter.
// Escaped dots are interpreted literally.

java.lang.Object o = initialContext.lookup("a\\.INS\.format");