implement file resolution for isReadable() as well

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3547 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2010-08-08 23:21:41 +00:00
parent 4132414f4f
commit ca58577eb1
@@ -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();