Skip to content

Commit 2c7d2f7

Browse files
jhoellercbeams
authored andcommitted
Handle non-existent files in ServletContextResource
ServletContextResource#getFile now falls back to #getRealPath for non-existent files Issue: SPR-8461
1 parent c8e693b commit 2c7d2f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ public URL getURL() throws IOException {
166166
*/
167167
@Override
168168
public File getFile() throws IOException {
169-
URL url = getURL();
170-
if (ResourceUtils.isFileURL(url)) {
169+
URL url = this.servletContext.getResource(this.path);
170+
if (url != null && ResourceUtils.isFileURL(url)) {
171171
// Proceed with file system resolution...
172172
return super.getFile();
173173
}

0 commit comments

Comments
 (0)