mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Apply ResourceHandlerUtils to Groovy markup templates
Closes gh-36902
This commit is contained in:
+6
-1
@@ -35,6 +35,7 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.servlet.resource.ResourceHandlerUtils;
|
||||
|
||||
/**
|
||||
* An extension of Groovy's {@link groovy.text.markup.TemplateConfiguration} and
|
||||
@@ -223,7 +224,11 @@ public class GroovyMarkupConfigurer extends TemplateConfiguration
|
||||
@Override
|
||||
public URL resolveTemplate(String templatePath) throws IOException {
|
||||
Assert.state(this.classLoader != null, "No template ClassLoader available");
|
||||
return GroovyMarkupConfigurer.this.resolveTemplate(this.classLoader, templatePath);
|
||||
String path = ResourceHandlerUtils.normalizeInputPath(templatePath);
|
||||
if (ResourceHandlerUtils.shouldIgnoreInputPath(path)) {
|
||||
throw new IOException("Invalid template path:" + templatePath);
|
||||
}
|
||||
return GroovyMarkupConfigurer.this.resolveTemplate(this.classLoader, path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user