FileUrlResource creates same class from createRelative

Issue: SPR-16140
This commit is contained in:
Juergen Hoeller 2017-11-05 21:01:29 +01:00
parent a75dd2dd3e
commit 07b479e264
2 changed files with 9 additions and 1 deletions

View File

@ -70,6 +70,14 @@ public class FileUrlResource extends UrlResource implements WritableResource {
}
@Override
public Resource createRelative(String relativePath) throws MalformedURLException {
if (relativePath.startsWith("/")) {
relativePath = relativePath.substring(1);
}
return new FileUrlResource(new URL(getURL(), relativePath));
}
@Override
public boolean isWritable() {
try {

View File

@ -183,7 +183,7 @@ public class UrlResource extends AbstractFileResolvingResource {
* This implementation returns the underlying URL reference.
*/
@Override
public URL getURL() throws IOException {
public URL getURL() {
return this.url;
}