mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Apply ResourceHandlerUtils checks in XsltView
Closes gh-37029
This commit is contained in:
committed by
Brian Clozel
parent
8647e90bc7
commit
692dbc9160
@@ -53,6 +53,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.SimpleTransformErrorListener;
|
||||
import org.springframework.util.xml.TransformerUtils;
|
||||
import org.springframework.web.servlet.resource.ResourceHandlerUtils;
|
||||
import org.springframework.web.servlet.view.AbstractUrlBasedView;
|
||||
import org.springframework.web.util.WebUtils;
|
||||
|
||||
@@ -457,12 +458,15 @@ public class XsltView extends AbstractUrlBasedView {
|
||||
protected Source getStylesheetSource() {
|
||||
String url = getUrl();
|
||||
Assert.state(url != null, "'url' not set");
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Applying stylesheet [" + url + "]");
|
||||
}
|
||||
String location = ResourceHandlerUtils.normalizeInputPath(url);
|
||||
if (ResourceHandlerUtils.shouldIgnoreInputPath(location)) {
|
||||
throw new ApplicationContextException("Invalid XSLT stylesheet location '" + url + "'");
|
||||
}
|
||||
try {
|
||||
Resource resource = obtainApplicationContext().getResource(url);
|
||||
Resource resource = obtainApplicationContext().getResource(location);
|
||||
return new StreamSource(resource.getInputStream(), resource.getURI().toASCIIString());
|
||||
}
|
||||
catch (IOException ex) {
|
||||
|
||||
Reference in New Issue
Block a user