implement file resolution for isReadable() as well

This commit is contained in:
Juergen Hoeller
2010-08-08 23:21:41 +00:00
parent 2b4e714c68
commit bda3d81bc9

View File

@@ -110,6 +110,24 @@ public abstract class AbstractFileResolvingResource extends AbstractResource {
}
}
@Override
public boolean isReadable() {
try {
URL url = getURL();
if (ResourceUtils.isFileURL(url)) {
// Proceed with file system resolution...
File file = getFile();
return (file.canRead() && !file.isDirectory());
}
else {
return true;
}
}
catch (IOException ex) {
return false;
}
}
@Override
public int contentLength() throws IOException {
URL url = getURL();