commit
01404aa27b
|
@ -337,7 +337,7 @@ public class ServerProperties {
|
||||||
* Whether HTTP 1.1 and later location headers generated by a call to sendRedirect
|
* Whether HTTP 1.1 and later location headers generated by a call to sendRedirect
|
||||||
* will use relative or absolute redirects.
|
* will use relative or absolute redirects.
|
||||||
*/
|
*/
|
||||||
private Boolean useRelativeRedirects;
|
private boolean useRelativeRedirects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character encoding to use to decode the URI.
|
* Character encoding to use to decode the URI.
|
||||||
|
@ -532,14 +532,19 @@ public class ServerProperties {
|
||||||
this.redirectContextRoot = redirectContextRoot;
|
this.redirectContextRoot = redirectContextRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getUseRelativeRedirects() {
|
public boolean getUseRelativeRedirects() {
|
||||||
return this.useRelativeRedirects;
|
return this.useRelativeRedirects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseRelativeRedirects(Boolean useRelativeRedirects) {
|
public void setUseRelativeRedirects(boolean useRelativeRedirects) {
|
||||||
this.useRelativeRedirects = useRelativeRedirects;
|
this.useRelativeRedirects = useRelativeRedirects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setUseRelativeRedirects(Boolean useRelativeRedirects) {
|
||||||
|
this.useRelativeRedirects = (useRelativeRedirects != null) ? useRelativeRedirects : false;
|
||||||
|
}
|
||||||
|
|
||||||
public Charset getUriEncoding() {
|
public Charset getUriEncoding() {
|
||||||
return this.uriEncoding;
|
return this.uriEncoding;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,7 @@ public class TomcatServletWebServerFactoryCustomizer
|
||||||
if (tomcatProperties.getRedirectContextRoot() != null) {
|
if (tomcatProperties.getRedirectContextRoot() != null) {
|
||||||
customizeRedirectContextRoot(factory, tomcatProperties.getRedirectContextRoot());
|
customizeRedirectContextRoot(factory, tomcatProperties.getRedirectContextRoot());
|
||||||
}
|
}
|
||||||
if (tomcatProperties.getUseRelativeRedirects() != null) {
|
customizeUseRelativeRedirects(factory, tomcatProperties.getUseRelativeRedirects());
|
||||||
customizeUseRelativeRedirects(factory, tomcatProperties.getUseRelativeRedirects());
|
|
||||||
}
|
|
||||||
factory.setDisableMBeanRegistry(!tomcatProperties.getMbeanregistry().isEnabled());
|
factory.setDisableMBeanRegistry(!tomcatProperties.getMbeanregistry().isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ class ServerPropertiesTests {
|
||||||
map.put("server.tomcat.background-processor-delay", "10");
|
map.put("server.tomcat.background-processor-delay", "10");
|
||||||
map.put("server.tomcat.relaxed-path-chars", "|,<");
|
map.put("server.tomcat.relaxed-path-chars", "|,<");
|
||||||
map.put("server.tomcat.relaxed-query-chars", "^ , | ");
|
map.put("server.tomcat.relaxed-query-chars", "^ , | ");
|
||||||
|
map.put("server.tomcat.use-relative-redirects", "true");
|
||||||
bind(map);
|
bind(map);
|
||||||
ServerProperties.Tomcat tomcat = this.properties.getTomcat();
|
ServerProperties.Tomcat tomcat = this.properties.getTomcat();
|
||||||
Accesslog accesslog = tomcat.getAccesslog();
|
Accesslog accesslog = tomcat.getAccesslog();
|
||||||
|
@ -147,6 +148,7 @@ class ServerPropertiesTests {
|
||||||
assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10);
|
assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10);
|
||||||
assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<');
|
assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<');
|
||||||
assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|');
|
assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|');
|
||||||
|
assertThat(tomcat.getUseRelativeRedirects()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -443,6 +445,11 @@ class ServerPropertiesTests {
|
||||||
.isEqualTo(new RemoteIpValve().getInternalProxies());
|
.isEqualTo(new RemoteIpValve().getInternalProxies());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void tomcatUseRelativeRedirectsDefaultsToFalse() {
|
||||||
|
assertThat(this.properties.getTomcat().getUseRelativeRedirects()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void jettyMaxHttpFormPostSizeMatchesDefault() throws Exception {
|
void jettyMaxHttpFormPostSizeMatchesDefault() throws Exception {
|
||||||
JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0);
|
JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0);
|
||||||
|
|
|
@ -214,7 +214,6 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
||||||
: ClassUtils.getDefaultClassLoader());
|
: ClassUtils.getDefaultClassLoader());
|
||||||
resetDefaultLocaleMapping(context);
|
resetDefaultLocaleMapping(context);
|
||||||
addLocaleMappings(context);
|
addLocaleMappings(context);
|
||||||
context.setUseRelativeRedirects(false);
|
|
||||||
try {
|
try {
|
||||||
context.setCreateUploadTargets(true);
|
context.setCreateUploadTargets(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue