Browse Source

implement file resolution for isReadable() as well

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3547 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
ca58577eb1
  1. 18
      org.springframework.core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java

18
org.springframework.core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java

@ -110,6 +110,24 @@ public abstract class AbstractFileResolvingResource extends AbstractResource { @@ -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();

Loading…
Cancel
Save