protected void processAnnotationsJndi(URL url, WebXml fragment,
boolean handlesTypesOnly) {
try {
URLConnection urlConn = url.openConnection();
DirContextURLConnection dcUrlConn;
if (!(urlConn instanceof DirContextURLConnection)) {
// This should never happen
sm.getString("contextConfig.jndiUrlNotDirContextConn", url);
return;
}
dcUrlConn = (DirContextURLConnection) urlConn;
dcUrlConn.setUseCaches(false);
String type = dcUrlConn.getHeaderField(ResourceAttributes.TYPE);
if (ResourceAttributes.COLLECTION_TYPE.equals(type)) {
// Collection
Enumeration<String> dirs = dcUrlConn.list();
while (dirs.hasMoreElements()) {
String dir = dirs.nextElement();
URL dirUrl = new URL(url.toString() + '/' + dir);
processAnnotationsJndi(dirUrl, fragment, handlesTypesOnly);
}
} else {
// Single file
if (url.getPath().endsWith(".class")) {
InputStream is = null;
try {
is = dcUrlConn.getInputStream();
processAnnotationsStream(
is, fragment, handlesTypesOnly);
} catch (IOException e) {
log.error(sm.getString("contextConfig.inputStreamJndi",
url),e);