This commit is contained in:
ivanov.denis 2024-09-30 15:34:19 +03:00
parent d7ad12ea94
commit 6866bacf52
2 changed files with 16 additions and 7 deletions

View file

@ -3,6 +3,8 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import com.hazelcast.internal.util.JsonUtil;
import org.jooq.impl.QOM;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import org.springframework.web.util.IntrospectorCleanupListener;
@ -13,13 +15,6 @@ import org.springframework.web.util.IntrospectorCleanupListener;
*/
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Value("${ervu.fileupload.max_file_size}")
private int maxFileSize;
@Value("${ervu.fileupload.max_request_size}")
private int maxRequestSize;
@Value("${ervu.fileupload.file_size_threshold}")
private int fileSizeThreshold;
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
servletContext.addListener(new IntrospectorCleanupListener());
@ -41,11 +36,21 @@ public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServlet
@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
int maxFileSize = Integer.parseInt(System.getenv("ervu.fileupload.max_file_size"));
int maxRequestSize = Integer.parseInt(System.getenv("${ervu.fileupload.max_request_size}"));
int fileSizeThreshold = Integer.parseInt(System.getenv("${ervu.fileupload.file_size_threshold}"));
MultipartConfigElement multipartConfigElement = new MultipartConfigElement(
"/tmp",
maxFileSize,
maxRequestSize,
fileSizeThreshold);
registration.setMultipartConfig(multipartConfigElement);
System.out.println("=8=8> MFS : " + multipartConfigElement.getMaxFileSize());
System.out.println("=8=8> MRS : " + multipartConfigElement.getMaxRequestSize());
System.out.println("=8=8> FST : " + multipartConfigElement.getFileSizeThreshold());
}
}

View file

@ -46,3 +46,7 @@ ERVU_KAFKA_EXCERPT_REQUEST_TOPIC=ervu.lkrp.excerpt.request
S3_ENDPOINT=http://ervu-minio.k8s.micord.ru:31900
S3_ACCESS_KEY=rlTdTvkmSXu9FsLhfecw
S3_SECRET_KEY=NUmY0wwRIEyAd98GCKd1cOgJWvLQYAcMMul5Ulu0
ervu.fileupload.max_file_size=1
ervu.fileupload.max_request_size=10
ervu.fileupload.file_size_threshold=10