Commit b725c601 authored by Andy Wilkinson's avatar Andy Wilkinson

Deprecate DeploymentInfo customization with reactive Undertow

Fixes gh-17555
parent 30b5ba87
...@@ -44,6 +44,7 @@ import org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactor ...@@ -44,6 +44,7 @@ import org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactor
import org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryCustomizer; import org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryCustomizer; import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.servlet.TomcatServletWebServerFactoryCustomizer; import org.springframework.boot.autoconfigure.web.servlet.TomcatServletWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.servlet.UndertowServletWebServerFactoryCustomizer;
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
...@@ -113,7 +114,7 @@ class ServletManagementChildContextConfiguration { ...@@ -113,7 +114,7 @@ class ServletManagementChildContextConfiguration {
ServletManagementWebServerFactoryCustomizer(ListableBeanFactory beanFactory) { ServletManagementWebServerFactoryCustomizer(ListableBeanFactory beanFactory) {
super(beanFactory, ServletWebServerFactoryCustomizer.class, TomcatServletWebServerFactoryCustomizer.class, super(beanFactory, ServletWebServerFactoryCustomizer.class, TomcatServletWebServerFactoryCustomizer.class,
TomcatWebServerFactoryCustomizer.class, JettyWebServerFactoryCustomizer.class, TomcatWebServerFactoryCustomizer.class, JettyWebServerFactoryCustomizer.class,
UndertowWebServerFactoryCustomizer.class); UndertowServletWebServerFactoryCustomizer.class, UndertowWebServerFactoryCustomizer.class);
} }
@Override @Override
......
...@@ -82,8 +82,6 @@ public class UndertowWebServerFactoryCustomizer ...@@ -82,8 +82,6 @@ public class UndertowWebServerFactoryCustomizer
.to((maxHttpPostSize) -> customizeMaxHttpPostSize(factory, maxHttpPostSize)); .to((maxHttpPostSize) -> customizeMaxHttpPostSize(factory, maxHttpPostSize));
propertyMapper.from(properties::getConnectionTimeout) propertyMapper.from(properties::getConnectionTimeout)
.to((connectionTimeout) -> customizeConnectionTimeout(factory, connectionTimeout)); .to((connectionTimeout) -> customizeConnectionTimeout(factory, connectionTimeout));
factory.addDeploymentInfoCustomizers(
(deploymentInfo) -> deploymentInfo.setEagerFilterInit(undertowProperties.isEagerFilterInit()));
} }
private boolean isPositive(Number value) { private boolean isPositive(Number value) {
......
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.web.servlet;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
/**
* {@link WebServerFactoryCustomizer} to apply {@link ServerProperties} to Undertow
* Servlet web servers.
*
* @author Andy Wilkinson
* @since 2.1.7
*/
public class UndertowServletWebServerFactoryCustomizer
implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
private final ServerProperties serverProperties;
public UndertowServletWebServerFactoryCustomizer(ServerProperties serverProperties) {
this.serverProperties = serverProperties;
}
@Override
public void customize(UndertowServletWebServerFactory factory) {
factory.addDeploymentInfoCustomizers((deploymentInfo) -> deploymentInfo
.setEagerFilterInit(this.serverProperties.getUndertow().isEagerFilterInit()));
}
}
...@@ -44,7 +44,12 @@ public interface ConfigurableUndertowWebServerFactory extends ConfigurableWebSer ...@@ -44,7 +44,12 @@ public interface ConfigurableUndertowWebServerFactory extends ConfigurableWebSer
* Add {@link UndertowDeploymentInfoCustomizer}s that should be used to customize the * Add {@link UndertowDeploymentInfoCustomizer}s that should be used to customize the
* Undertow {@link DeploymentInfo}. * Undertow {@link DeploymentInfo}.
* @param customizers the customizers to add * @param customizers the customizers to add
* @deprecated since 2.1.7 in favor of
* {@link UndertowServletWebServerFactory#addDeploymentInfoCustomizers(UndertowDeploymentInfoCustomizer...)}
* as {@link UndertowReactiveWebServerFactory} does not create a
* {@link DeploymentInfo}
*/ */
@Deprecated
void addDeploymentInfoCustomizers(UndertowDeploymentInfoCustomizer... customizers); void addDeploymentInfoCustomizers(UndertowDeploymentInfoCustomizer... customizers);
/** /**
......
...@@ -54,6 +54,7 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF ...@@ -54,6 +54,7 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF
private List<UndertowBuilderCustomizer> builderCustomizers = new ArrayList<>(); private List<UndertowBuilderCustomizer> builderCustomizers = new ArrayList<>();
@Deprecated
private List<UndertowDeploymentInfoCustomizer> deploymentInfoCustomizers = new ArrayList<>(); private List<UndertowDeploymentInfoCustomizer> deploymentInfoCustomizers = new ArrayList<>();
private Integer bufferSize; private Integer bufferSize;
...@@ -203,7 +204,10 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF ...@@ -203,7 +204,10 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF
* Undertow {@link DeploymentInfo}. Calling this method will replace any existing * Undertow {@link DeploymentInfo}. Calling this method will replace any existing
* customizers. * customizers.
* @param customizers the customizers to set * @param customizers the customizers to set
* @deprecated since 2.1.7 as the factory does not create a {@link DeploymentInfo}
* making customization redundant
*/ */
@Deprecated
public void setDeploymentInfoCustomizers(Collection<? extends UndertowDeploymentInfoCustomizer> customizers) { public void setDeploymentInfoCustomizers(Collection<? extends UndertowDeploymentInfoCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null"); Assert.notNull(customizers, "Customizers must not be null");
this.deploymentInfoCustomizers = new ArrayList<>(customizers); this.deploymentInfoCustomizers = new ArrayList<>(customizers);
...@@ -213,7 +217,10 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF ...@@ -213,7 +217,10 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF
* Returns a mutable collection of the {@link UndertowDeploymentInfoCustomizer}s that * Returns a mutable collection of the {@link UndertowDeploymentInfoCustomizer}s that
* will be applied to the Undertow {@link DeploymentInfo}. * will be applied to the Undertow {@link DeploymentInfo}.
* @return the customizers that will be applied * @return the customizers that will be applied
* @deprecated since 2.1.7 as the factory does not create a {@link DeploymentInfo}
* making customization redundant
*/ */
@Deprecated
public Collection<UndertowDeploymentInfoCustomizer> getDeploymentInfoCustomizers() { public Collection<UndertowDeploymentInfoCustomizer> getDeploymentInfoCustomizers() {
return this.deploymentInfoCustomizers; return this.deploymentInfoCustomizers;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment