Upgrade to Tomcat 8.0.30 and continue to use absolute redirects

Tomcat 8.0.30 has changed to using relative URIs in its redirects
by default. To avoid any problems that this behaviour change may
causes we override the default and configure Tomcat to continue to
use absolute URIs.

Closes gh-4715
This commit is contained in:
Andy Wilkinson 2015-12-09 11:51:47 +00:00
parent b10b7a883d
commit ae6971a61a
2 changed files with 7 additions and 1 deletions

View File

@ -134,7 +134,7 @@
<thymeleaf-extras-conditionalcomments.version>2.1.1.RELEASE</thymeleaf-extras-conditionalcomments.version>
<thymeleaf-layout-dialect.version>1.2.9</thymeleaf-layout-dialect.version>
<thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
<tomcat.version>8.0.28</tomcat.version>
<tomcat.version>8.0.30</tomcat.version>
<undertow.version>1.1.9.Final</undertow.version>
<velocity.version>1.7</velocity.version>
<velocity-tools.version>2.0</velocity-tools.version>

View File

@ -167,6 +167,12 @@ public class TomcatEmbeddedServletContainerFactory
context.setParentClassLoader(
this.resourceLoader != null ? this.resourceLoader.getClassLoader()
: ClassUtils.getDefaultClassLoader());
try {
context.setUseRelativeRedirects(false);
}
catch (NoSuchMethodError ex) {
// Tomcat is < 8.0.30. Continue
}
SkipPatternJarScanner.apply(context, this.tldSkip);
WebappLoader loader = new WebappLoader(context.getParentClassLoader());
loader.setLoaderClass(TomcatEmbeddedWebappClassLoader.class.getName());