@@ -83,73 +83,66 @@ public int getOrder() {
8383
8484 @ Override
8585 public void customize (ConfigurableTomcatWebServerFactory factory ) {
86- ServerProperties properties = this .serverProperties ;
87- ServerProperties .Tomcat tomcatProperties = properties .getTomcat ();
88- PropertyMapper propertyMapper = PropertyMapper .get ();
89- propertyMapper .from (tomcatProperties ::getBasedir ).whenNonNull ().to (factory ::setBaseDirectory );
90- propertyMapper .from (tomcatProperties ::getBackgroundProcessorDelay )
91- .whenNonNull ()
86+ ServerProperties .Tomcat properties = this .serverProperties .getTomcat ();
87+ PropertyMapper map = PropertyMapper .get ().alwaysApplyingWhenNonNull ();
88+ map .from (properties ::getBasedir ).to (factory ::setBaseDirectory );
89+ map .from (properties ::getBackgroundProcessorDelay )
9290 .as (Duration ::getSeconds )
9391 .as (Long ::intValue )
9492 .to (factory ::setBackgroundProcessorDelay );
9593 customizeRemoteIpValve (factory );
96- ServerProperties .Tomcat .Threads threadProperties = tomcatProperties .getThreads ();
97- propertyMapper .from (threadProperties ::getMax )
94+ ServerProperties .Tomcat .Threads threadProperties = properties .getThreads ();
95+ map .from (threadProperties ::getMax )
9896 .when (this ::isPositive )
9997 .to ((maxThreads ) -> customizeMaxThreads (factory , threadProperties .getMax ()));
100- propertyMapper .from (threadProperties ::getMinSpare )
98+ map .from (threadProperties ::getMinSpare )
10199 .when (this ::isPositive )
102100 .to ((minSpareThreads ) -> customizeMinThreads (factory , minSpareThreads ));
103- propertyMapper .from (this .serverProperties .getMaxHttpRequestHeaderSize ())
104- .whenNonNull ()
101+ map .from (this .serverProperties .getMaxHttpRequestHeaderSize ())
105102 .asInt (DataSize ::toBytes )
106103 .when (this ::isPositive )
107104 .to ((maxHttpRequestHeaderSize ) -> customizeMaxHttpRequestHeaderSize (factory , maxHttpRequestHeaderSize ));
108- propertyMapper .from (tomcatProperties ::getMaxHttpResponseHeaderSize )
109- .whenNonNull ()
105+ map .from (properties ::getMaxHttpResponseHeaderSize )
110106 .asInt (DataSize ::toBytes )
111107 .when (this ::isPositive )
112108 .to ((maxHttpResponseHeaderSize ) -> customizeMaxHttpResponseHeaderSize (factory , maxHttpResponseHeaderSize ));
113- propertyMapper .from (tomcatProperties ::getMaxSwallowSize )
114- .whenNonNull ()
109+ map .from (properties ::getMaxSwallowSize )
115110 .asInt (DataSize ::toBytes )
116111 .to ((maxSwallowSize ) -> customizeMaxSwallowSize (factory , maxSwallowSize ));
117- propertyMapper .from (tomcatProperties ::getMaxHttpFormPostSize )
112+ map .from (properties ::getMaxHttpFormPostSize )
118113 .asInt (DataSize ::toBytes )
119114 .when ((maxHttpFormPostSize ) -> maxHttpFormPostSize != 0 )
120115 .to ((maxHttpFormPostSize ) -> customizeMaxHttpFormPostSize (factory , maxHttpFormPostSize ));
121- propertyMapper .from (tomcatProperties ::getAccesslog )
116+ map .from (properties ::getAccesslog )
122117 .when (ServerProperties .Tomcat .Accesslog ::isEnabled )
123118 .to ((enabled ) -> customizeAccessLog (factory ));
124- propertyMapper .from (tomcatProperties ::getUriEncoding ).whenNonNull ().to (factory ::setUriEncoding );
125- propertyMapper .from (tomcatProperties ::getConnectionTimeout )
126- .whenNonNull ()
119+ map .from (properties ::getUriEncoding ).to (factory ::setUriEncoding );
120+ map .from (properties ::getConnectionTimeout )
127121 .to ((connectionTimeout ) -> customizeConnectionTimeout (factory , connectionTimeout ));
128- propertyMapper .from (tomcatProperties ::getMaxConnections )
122+ map .from (properties ::getMaxConnections )
129123 .when (this ::isPositive )
130124 .to ((maxConnections ) -> customizeMaxConnections (factory , maxConnections ));
131- propertyMapper .from (tomcatProperties ::getAcceptCount )
125+ map .from (properties ::getAcceptCount )
132126 .when (this ::isPositive )
133127 .to ((acceptCount ) -> customizeAcceptCount (factory , acceptCount ));
134- propertyMapper .from (tomcatProperties ::getProcessorCache )
128+ map .from (properties ::getProcessorCache )
135129 .to ((processorCache ) -> customizeProcessorCache (factory , processorCache ));
136- propertyMapper .from (tomcatProperties ::getKeepAliveTimeout )
137- .whenNonNull ()
130+ map .from (properties ::getKeepAliveTimeout )
138131 .to ((keepAliveTimeout ) -> customizeKeepAliveTimeout (factory , keepAliveTimeout ));
139- propertyMapper .from (tomcatProperties ::getMaxKeepAliveRequests )
132+ map .from (properties ::getMaxKeepAliveRequests )
140133 .to ((maxKeepAliveRequests ) -> customizeMaxKeepAliveRequests (factory , maxKeepAliveRequests ));
141- propertyMapper .from (tomcatProperties ::getRelaxedPathChars )
134+ map .from (properties ::getRelaxedPathChars )
142135 .as (this ::joinCharacters )
143136 .whenHasText ()
144137 .to ((relaxedChars ) -> customizeRelaxedPathChars (factory , relaxedChars ));
145- propertyMapper .from (tomcatProperties ::getRelaxedQueryChars )
138+ map .from (properties ::getRelaxedQueryChars )
146139 .as (this ::joinCharacters )
147140 .whenHasText ()
148141 .to ((relaxedChars ) -> customizeRelaxedQueryChars (factory , relaxedChars ));
149- propertyMapper .from (tomcatProperties ::isRejectIllegalHeader )
142+ map .from (properties ::isRejectIllegalHeader )
150143 .to ((rejectIllegalHeader ) -> customizeRejectIllegalHeader (factory , rejectIllegalHeader ));
151144 customizeStaticResources (factory );
152- customizeErrorReportValve (properties .getError (), factory );
145+ customizeErrorReportValve (this . serverProperties .getError (), factory );
153146 }
154147
155148 private boolean isPositive (int value ) {
0 commit comments