本文整理汇总了Java中javax.naming.Name.add方法的典型用法代码示例。如果您正苦于以下问题:Java Name.add方法的具体用法?Java Name.add怎么用?Java Name.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.Name
的用法示例。
在下文中一共展示了Name.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseName
import javax.naming.Name; //导入方法依赖的package包/类
/**
* Strips the URL header.
*
* @return the parsed name
* @exception NamingException if there is no "java:" header or if no
* naming context has been bound to this thread
*/
protected Name parseName(Name name)
throws NamingException {
if (!initialContext && !name.isEmpty() &&
name.get(0).startsWith(prefix)) {
if (name.get(0).equals(prefix)) {
return name.getSuffix(1);
} else {
Name result = name.getSuffix(1);
result.add(0, name.get(0).substring(prefixLength));
return result;
}
} else {
if (initialContext) {
return name;
} else {
throw new NamingException(
sm.getString("selectorContext.noJavaUrl"));
}
}
}
示例2: getNameInNamespace
import javax.naming.Name; //导入方法依赖的package包/类
@Override
public String getNameInNamespace() throws NamingException {
LocalContext ancestor = iParent;
if (ancestor == null) return "";
Name name = parse("");
name.add(iName);
while (ancestor != null && ancestor.iName != null) {
name.add(0, ancestor.iName);
ancestor = ancestor.iParent;
}
return name.toString();
}
示例3: parseName
import javax.naming.Name; //导入方法依赖的package包/类
/**
* Strips the URL header.
*
* @return the parsed name
* @exception NamingException
* if there is no "java:" header or if no naming context has
* been bound to this thread
*/
protected Name parseName(Name name) throws NamingException {
if (!initialContext && !name.isEmpty() && name.get(0).startsWith(prefix)) {
if (name.get(0).equals(prefix)) {
return name.getSuffix(1);
} else {
Name result = name.getSuffix(1);
result.add(0, name.get(0).substring(prefixLength));
return result;
}
} else {
if (initialContext) {
return name;
} else {
throw new NamingException(sm.getString("selectorContext.noJavaUrl"));
}
}
}
示例4: jndiName
import javax.naming.Name; //导入方法依赖的package包/类
/**
* Converts a given DN into one suitable for use through JNDI. In particular, escapes special characters such as '/'
* which have special meaning to JNDI.
*
* @param dn
* the dn
* @return the name
* @throws InvalidNameException
* the invalid name exception
*/
public static Name jndiName(String dn) throws InvalidNameException
{
Name n = new CompositeName();
n.add(dn);
return n;
}