mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-20 04:09:04 +00:00
implement file resolution for isReadable() as well
This commit is contained in:
+18
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user