org.zodiac.autoconfigure.web.WebFluxMultipartAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.web;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.zodiac.autoconfigure.web.condition.ConditionalOnReactiveMultipartEnabled;
@SpringBootConfiguration
@ConditionalOnReactiveMultipartEnabled
@ConditionalOnWebApplication(type = Type.REACTIVE)
@ConditionalOnClass(value = {org.synchronoss.cloud.nio.multipart.Multipart.class, org.springframework.http.codec.HttpMessageReader.class, org.springframework.web.server.WebHandler.class, org.springframework.web.reactive.DispatcherHandler.class})
public class WebFluxMultipartAutoConfiguration implements org.springframework.web.reactive.config.WebFluxConfigurer {
private ReactiveMultipartConfigProperties multipartConfigProperties;
public WebFluxMultipartAutoConfiguration(ReactiveMultipartConfigProperties multipartConfigProperties) {
this.multipartConfigProperties = multipartConfigProperties;
}
@Override
public void configureHttpMessageCodecs(org.springframework.http.codec.ServerCodecConfigurer configurer) {
org.springframework.http.codec.multipart.SynchronossPartHttpMessageReader partReader = new org.springframework.http.codec.multipart.SynchronossPartHttpMessageReader();
partReader.setMaxParts(multipartConfigProperties.getMaxParts());
partReader.setMaxDiskUsagePerPart(multipartConfigProperties.getMaxDiskUsagePerPart().toBytes());
partReader.setEnableLoggingRequestDetails(multipartConfigProperties.isEnableRequestLogging());
partReader.setMaxInMemorySize(Long.valueOf(multipartConfigProperties.getMaxMemorySizePerPart().toBytes()).intValue());
org.springframework.http.codec.multipart.MultipartHttpMessageReader multipartReader = new org.springframework.http.codec.multipart.MultipartHttpMessageReader(partReader);
multipartReader.setEnableLoggingRequestDetails(multipartConfigProperties.isEnableRequestLogging());
configurer.defaultCodecs().multipartReader(multipartReader);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy