implement file resolution for isReadable() as well
This commit is contained in:
@@ -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
|
@Override
|
||||||
public int contentLength() throws IOException {
|
public int contentLength() throws IOException {
|
||||||
URL url = getURL();
|
URL url = getURL();
|
||||||
|
|||||||
Reference in New Issue
Block a user