use of org.apache.tomcat.util.buf.UEncoder in project tomcat70 by apache.
the class DirContextURLConnection method list.
// --------------------------------------------------------- Public Methods
/**
* List children of this collection. The names given are relative to this
* URI's path. The full uri of the children is then : path + "/" + name.
*/
public Enumeration<String> list() throws IOException {
if (!connected) {
connect();
}
if ((resource == null) && (collection == null)) {
throw new FileNotFoundException(getURL() == null ? "null" : getURL().toString());
}
Vector<String> result = new Vector<String>();
if (collection != null) {
try {
NamingEnumeration<NameClassPair> enumeration = collection.list("/");
UEncoder urlEncoder = new UEncoder(UEncoder.SafeCharsSet.WITH_SLASH);
while (enumeration.hasMoreElements()) {
NameClassPair ncp = enumeration.nextElement();
String s = ncp.getName();
result.addElement(urlEncoder.encodeURL(s, 0, s.length()).toString());
}
} catch (NamingException e) {
// Unexpected exception
throw new FileNotFoundException(getURL() == null ? "null" : getURL().toString());
}
}
return result.elements();
}
Aggregations