org.apache.naming.resources.WARDirContext.getEscapedJndiName()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.apache.naming.resources.WARDirContext.getEscapedJndiName()方法的一些代码示例,展示了WARDirContext.getEscapedJndiName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WARDirContext.getEscapedJndiName()方法的具体详情如下:
包路径:org.apache.naming.resources.WARDirContext
类名称:WARDirContext
方法名:getEscapedJndiName

WARDirContext.getEscapedJndiName介绍

[英]JNDI treats ' and " as reserved characters therefore they need to be escaped as part of converting file names to JNDI names. Note that while ' can be used in Windows and Unix file names, " is only valid on Unix. This method assumes that the string is currently unquoted.
[中]JNDI将“和”视为保留字符,因此在将文件名转换为JNDI名称时需要对其进行转义。请注意,虽然“可用于Windows和Unix文件名”,但仅在Unix上有效。此方法假定字符串当前未加引号。

代码示例

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Retrieves selected attributes associated with a named object. 
 * See the class description regarding attribute models, attribute type 
 * names, and operational attributes.
 * 
 * @return the requested attributes; never null
 * @param name the name of the object from which to retrieve attributes
 * @param attrIds the identifiers of the attributes to retrieve. null 
 * indicates that all attributes should be retrieved; an empty array 
 * indicates that none should be retrieved
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected Attributes doGetAttributes(String name, String[] attrIds)
  throws NamingException {
  return getAttributes(getEscapedJndiName(name), attrIds);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Enumerates the names bound in the named context, along with the class 
 * names of objects bound to them. The contents of any subcontexts are 
 * not included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param name the name of the context to list
 * @return an enumeration of the names and class names of the bindings in 
 * this context. Each element of the enumeration is of type NameClassPair.
 * @exception NamingException if a naming exception is encountered
 */
@Override
public NamingEnumeration<NameClassPair> list(String name)
  throws NamingException {
  return list(getEscapedJndiName(name));
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Retrieves selected attributes associated with a named object. 
 * See the class description regarding attribute models, attribute type 
 * names, and operational attributes.
 * 
 * @return the requested attributes; never null
 * @param name the name of the object from which to retrieve attributes
 * @param attrIds the identifiers of the attributes to retrieve. null 
 * indicates that all attributes should be retrieved; an empty array 
 * indicates that none should be retrieved
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected Attributes doGetAttributes(String name, String[] attrIds)
  throws NamingException {
  return getAttributes(getEscapedJndiName(name), attrIds);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Retrieves selected attributes associated with a named object. 
 * See the class description regarding attribute models, attribute type 
 * names, and operational attributes.
 * 
 * @return the requested attributes; never null
 * @param name the name of the object from which to retrieve attributes
 * @param attrIds the identifiers of the attributes to retrieve. null 
 * indicates that all attributes should be retrieved; an empty array 
 * indicates that none should be retrieved
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected Attributes doGetAttributes(String name, String[] attrIds)
  throws NamingException {
  return getAttributes(getEscapedJndiName(name), attrIds);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Retrieves selected attributes associated with a named object. 
 * See the class description regarding attribute models, attribute type 
 * names, and operational attributes.
 * 
 * @return the requested attributes; never null
 * @param name the name of the object from which to retrieve attributes
 * @param attrIds the identifiers of the attributes to retrieve. null 
 * indicates that all attributes should be retrieved; an empty array 
 * indicates that none should be retrieved
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected Attributes doGetAttributes(String name, String[] attrIds)
  throws NamingException {
  return getAttributes(getEscapedJndiName(name), attrIds);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Retrieves selected attributes associated with a named object. 
 * See the class description regarding attribute models, attribute type 
 * names, and operational attributes.
 * 
 * @return the requested attributes; never null
 * @param name the name of the object from which to retrieve attributes
 * @param attrIds the identifiers of the attributes to retrieve. null 
 * indicates that all attributes should be retrieved; an empty array 
 * indicates that none should be retrieved
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected Attributes doGetAttributes(String name, String[] attrIds)
  throws NamingException {
  return getAttributes(getEscapedJndiName(name), attrIds);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Enumerates the names bound in the named context, along with the class 
 * names of objects bound to them. The contents of any subcontexts are 
 * not included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param name the name of the context to list
 * @return an enumeration of the names and class names of the bindings in 
 * this context. Each element of the enumeration is of type NameClassPair.
 * @exception NamingException if a naming exception is encountered
 */
@Override
public NamingEnumeration<NameClassPair> list(String name)
  throws NamingException {
  return list(getEscapedJndiName(name));
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Enumerates the names bound in the named context, along with the class 
 * names of objects bound to them. The contents of any subcontexts are 
 * not included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param name the name of the context to list
 * @return an enumeration of the names and class names of the bindings in 
 * this context. Each element of the enumeration is of type NameClassPair.
 * @exception NamingException if a naming exception is encountered
 */
@Override
public NamingEnumeration<NameClassPair> list(String name)
  throws NamingException {
  return list(getEscapedJndiName(name));
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Enumerates the names bound in the named context, along with the class 
 * names of objects bound to them. The contents of any subcontexts are 
 * not included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param name the name of the context to list
 * @return an enumeration of the names and class names of the bindings in 
 * this context. Each element of the enumeration is of type NameClassPair.
 * @exception NamingException if a naming exception is encountered
 */
@Override
public NamingEnumeration<NameClassPair> list(String name)
  throws NamingException {
  return list(getEscapedJndiName(name));
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

int lastPos = 0;
while ((currentPos = name.indexOf('/', lastPos)) != -1) {
  Name parentName = getEscapedJndiName(name.substring(0, lastPos));
  Name childName = getEscapedJndiName(name.substring(0, currentPos));
  String entryName = name.substring(lastPos, currentPos);
Name compositeName = getEscapedJndiName(name.substring(0, pos));
Entry parent = treeLookup(compositeName);
Entry child = new Entry(entryName, entry);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Enumerates the names bound in the named context, along with the 
 * objects bound to them. The contents of any subcontexts are not 
 * included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param strName the name of the context to list
 * @return an enumeration of the bindings in this context. 
 * Each element of the enumeration is of type Binding.
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected NamingEnumeration<Binding> doListBindings(String strName)
  throws NamingException {
  
  Name name = getEscapedJndiName(strName);
  if (name.isEmpty())
    return new NamingContextBindingsEnumeration(list(entries).iterator(),
        this);
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
  
  return new NamingContextBindingsEnumeration(list(entry).iterator(),
      this);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Enumerates the names bound in the named context, along with the 
 * objects bound to them. The contents of any subcontexts are not 
 * included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param strName the name of the context to list
 * @return an enumeration of the bindings in this context. 
 * Each element of the enumeration is of type Binding.
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected NamingEnumeration<Binding> doListBindings(String strName)
  throws NamingException {
  
  Name name = getEscapedJndiName(strName);
  if (name.isEmpty())
    return new NamingContextBindingsEnumeration(list(entries).iterator(),
        this);
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
  
  return new NamingContextBindingsEnumeration(list(entry).iterator(),
      this);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Enumerates the names bound in the named context, along with the 
 * objects bound to them. The contents of any subcontexts are not 
 * included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param strName the name of the context to list
 * @return an enumeration of the bindings in this context. 
 * Each element of the enumeration is of type Binding.
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected NamingEnumeration<Binding> doListBindings(String strName)
  throws NamingException {
  
  Name name = getEscapedJndiName(strName);
  if (name.isEmpty())
    return new NamingContextBindingsEnumeration(list(entries).iterator(),
        this);
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
  
  return new NamingContextBindingsEnumeration(list(entry).iterator(),
      this);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Enumerates the names bound in the named context, along with the 
 * objects bound to them. The contents of any subcontexts are not 
 * included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param strName the name of the context to list
 * @return an enumeration of the bindings in this context. 
 * Each element of the enumeration is of type Binding.
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected List<NamingEntry> doListBindings(String strName)
  throws NamingException {
  
  Name name = getEscapedJndiName(strName);
  if (name.isEmpty())
    return list(entries);
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
  
  return list(entry);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Enumerates the names bound in the named context, along with the 
 * objects bound to them. The contents of any subcontexts are not 
 * included.
 * <p>
 * If a binding is added to or removed from this context, its effect on 
 * an enumeration previously returned is undefined.
 * 
 * @param strName the name of the context to list
 * @return an enumeration of the bindings in this context. 
 * Each element of the enumeration is of type Binding.
 * @exception NamingException if a naming exception is encountered
 */
@Override
protected List<NamingEntry> doListBindings(String strName)
  throws NamingException {
  
  Name name = getEscapedJndiName(strName);
  if (name.isEmpty())
    return list(entries);
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
  
  return list(entry);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Retrieves the named object.
 * 
 * @param strName the name of the object to look up
 * @return the object bound to name
 */
@Override
protected Object doLookup(String strName) {
  Name name;
  try {
    name = getEscapedJndiName(strName);
  } catch (InvalidNameException e) {
    log.info(sm.getString("resources.invalidName", strName), e);
    return null;
  }
  if (name.isEmpty())
    return this;
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
    
  ZipEntry zipEntry = entry.getEntry();
  if (zipEntry.isDirectory())
    return new WARDirContext(base, entry);
  else
    return new WARResource(entry.getEntry());
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Retrieves the named object.
 * 
 * @param strName the name of the object to look up
 * @return the object bound to name
 */
@Override
protected Object doLookup(String strName) {
  Name name;
  try {
    name = getEscapedJndiName(strName);
  } catch (InvalidNameException e) {
    log.info(sm.getString("resources.invalidName", strName), e);
    return null;
  }
  if (name.isEmpty())
    return this;
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
    
  ZipEntry zipEntry = entry.getEntry();
  if (zipEntry.isDirectory())
    return new WARDirContext(base, entry);
  else
    return new WARResource(entry.getEntry());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Retrieves the named object.
 * 
 * @param strName the name of the object to look up
 * @return the object bound to name
 */
@Override
protected Object doLookup(String strName) {
  Name name;
  try {
    name = getEscapedJndiName(strName);
  } catch (InvalidNameException e) {
    log.info(sm.getString("resources.invalidName", strName), e);
    return null;
  }
  if (name.isEmpty())
    return this;
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
    
  ZipEntry zipEntry = entry.getEntry();
  if (zipEntry.isDirectory())
    return new WARDirContext(base, entry);
  else
    return new WARResource(entry.getEntry());
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Retrieves the named object.
 * 
 * @param strName the name of the object to look up
 * @return the object bound to name
 */
@Override
protected Object doLookup(String strName) {
  Name name;
  try {
    name = getEscapedJndiName(strName);
  } catch (InvalidNameException e) {
    log.info(sm.getString("resources.invalidName", strName), e);
    return null;
  }
  if (name.isEmpty())
    return this;
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
    
  ZipEntry zipEntry = entry.getEntry();
  if (zipEntry.isDirectory())
    return new WARDirContext(base, entry);
  else
    return new WARResource(entry.getEntry());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Retrieves the named object.
 * 
 * @param strName the name of the object to look up
 * @return the object bound to name
 */
@Override
protected Object doLookup(String strName) {
  Name name;
  try {
    name = getEscapedJndiName(strName);
  } catch (InvalidNameException e) {
    log.info(sm.getString("resources.invalidName", strName), e);
    return null;
  }
  if (name.isEmpty())
    return this;
  Entry entry = treeLookup(name);
  if (entry == null)
    return null;
    
  ZipEntry zipEntry = entry.getEntry();
  if (zipEntry.isDirectory())
    return new WARDirContext(base, entry);
  else
    return new WARResource(entry.getEntry());
}

相关文章