diff --git a/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/DispatcherServletConfiguration.java b/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/DispatcherServletConfiguration.java index 13ede579093..faba1aaceb6 100644 --- a/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/DispatcherServletConfiguration.java +++ b/modules/flowable-app-engine-rest/src/test/java/org/flowable/app/rest/DispatcherServletConfiguration.java @@ -14,9 +14,6 @@ import java.util.List; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -24,6 +21,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -32,14 +30,12 @@ @ComponentScan({ "org.flowable.app.rest.service.api" }) public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired private ObjectMapper objectMapper; @Bean public MultipartResolver multipartResolver() { - return new PutAwareStandardServletMultiPartResolver(); + return new StandardServletMultipartResolver(); } @Override diff --git a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/DispatcherServletConfiguration.java b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/DispatcherServletConfiguration.java index 77d8d37858e..96f4ccbe4af 100644 --- a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/DispatcherServletConfiguration.java +++ b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/DispatcherServletConfiguration.java @@ -14,9 +14,6 @@ import java.util.List; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -24,6 +21,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -32,14 +30,12 @@ @ComponentScan({ "org.flowable.cmmn.rest.service.api" }) public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired private ObjectMapper objectMapper; @Bean public MultipartResolver multipartResolver() { - return new PutAwareStandardServletMultiPartResolver(); + return new StandardServletMultipartResolver(); } @Override diff --git a/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/multipart/PutAwareStandardServletMultiPartResolver.java b/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/multipart/PutAwareStandardServletMultiPartResolver.java deleted file mode 100644 index 118e0ff28cc..00000000000 --- a/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/multipart/PutAwareStandardServletMultiPartResolver.java +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 - * - * http://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.flowable.common.rest.multipart; - -import jakarta.servlet.http.HttpServletRequest; - -import org.springframework.util.StringUtils; -import org.springframework.web.multipart.support.StandardServletMultipartResolver; - -/** - * {@link org.springframework.web.multipart.MultipartResolver} that allows using PUT for multipart/form - * - * @author Filip Hrisafov - */ -public class PutAwareStandardServletMultiPartResolver extends StandardServletMultipartResolver { - - @Override - public boolean isMultipart(HttpServletRequest request) { - return request != null && isMultipartContent(request); - } - - /** - * Utility method that determines whether the request contains multipart content. - * - * @param request - * The servlet request to be evaluated. Must be non-null. - * @return true if the request is multipart; {@code false} otherwise. - * @see org.apache.commons.fileupload.servlet.ServletFileUpload#isMultipartContent(HttpServletRequest) - */ - public static final boolean isMultipartContent(HttpServletRequest request) { - final String method = request.getMethod().toLowerCase(); - if (!"post".equalsIgnoreCase(method) && !"put".equalsIgnoreCase(method)) { - return false; - } - - String contentType = request.getContentType(); - return StringUtils.startsWithIgnoreCase(contentType, "multipart/"); - } -} diff --git a/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/DispatcherServletConfiguration.java b/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/DispatcherServletConfiguration.java index 5b6d1ca8398..27cc980fb2a 100644 --- a/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/DispatcherServletConfiguration.java +++ b/modules/flowable-dmn-rest/src/test/java/org/flowable/dmn/rest/DispatcherServletConfiguration.java @@ -14,9 +14,6 @@ import java.util.List; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -24,6 +21,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -32,14 +30,12 @@ @ComponentScan({ "org.flowable.dmn.rest.exception", "org.flowable.dmn.rest.service.api" }) public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired private ObjectMapper objectMapper; @Bean public MultipartResolver multipartResolver() { - return new PutAwareStandardServletMultiPartResolver(); + return new StandardServletMultipartResolver(); } @Override diff --git a/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/DispatcherServletConfiguration.java b/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/DispatcherServletConfiguration.java index bfed58f355c..81511dde53f 100644 --- a/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/DispatcherServletConfiguration.java +++ b/modules/flowable-event-registry-rest/src/test/java/org/flowable/eventregistry/rest/DispatcherServletConfiguration.java @@ -14,9 +14,6 @@ import java.util.List; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -24,6 +21,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -32,14 +30,12 @@ @ComponentScan({ "org.flowable.eventregistry.rest.service.api" }) public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired private ObjectMapper objectMapper; @Bean public MultipartResolver multipartResolver() { - return new PutAwareStandardServletMultiPartResolver(); + return new StandardServletMultipartResolver(); } @Override diff --git a/modules/flowable-external-job-rest/src/test/java/org/flowable/external/job/rest/service/DispatcherServletConfiguration.java b/modules/flowable-external-job-rest/src/test/java/org/flowable/external/job/rest/service/DispatcherServletConfiguration.java index 54c4eb30133..d054aa1a81e 100644 --- a/modules/flowable-external-job-rest/src/test/java/org/flowable/external/job/rest/service/DispatcherServletConfiguration.java +++ b/modules/flowable-external-job-rest/src/test/java/org/flowable/external/job/rest/service/DispatcherServletConfiguration.java @@ -15,10 +15,7 @@ import java.util.Collections; import java.util.List; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; import org.flowable.external.job.rest.service.api.ExternalJobRestResponseFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -26,6 +23,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -37,8 +35,6 @@ }) public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired private ObjectMapper objectMapper; @@ -49,7 +45,7 @@ public ExternalJobRestResponseFactory externalJobRestResponseFactory(ObjectMappe @Bean public MultipartResolver multipartResolver() { - return new PutAwareStandardServletMultiPartResolver(); + return new StandardServletMultipartResolver(); } @Override diff --git a/modules/flowable-rest/src/test/java/org/flowable/rest/DispatcherServletConfiguration.java b/modules/flowable-rest/src/test/java/org/flowable/rest/DispatcherServletConfiguration.java index 9a9618a0c80..c5669045bf1 100644 --- a/modules/flowable-rest/src/test/java/org/flowable/rest/DispatcherServletConfiguration.java +++ b/modules/flowable-rest/src/test/java/org/flowable/rest/DispatcherServletConfiguration.java @@ -14,9 +14,6 @@ import java.util.List; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -24,6 +21,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -32,14 +30,12 @@ @ComponentScan({ "org.flowable.rest.exception", "org.flowable.rest.service.api" }) public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired private ObjectMapper objectMapper; @Bean public MultipartResolver multipartResolver() { - return new PutAwareStandardServletMultiPartResolver(); + return new StandardServletMultipartResolver(); } @Override diff --git a/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/DispatcherServletConfiguration.java b/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/DispatcherServletConfiguration.java index 9dec86282b0..7e23bb266f3 100644 --- a/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/DispatcherServletConfiguration.java +++ b/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/java/org/flowable/spring/boot/DispatcherServletConfiguration.java @@ -15,19 +15,13 @@ import java.util.List; import org.flowable.common.rest.exception.BaseExceptionHandlerAdvice; -import org.flowable.common.rest.multipart.PutAwareStandardServletMultiPartResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.web.multipart.MultipartResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import com.fasterxml.jackson.databind.ObjectMapper; @@ -41,18 +35,9 @@ @EnableAsync public class DispatcherServletConfiguration extends WebMvcConfigurationSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(DispatcherServletConfiguration.class); - @Autowired protected ObjectMapper objectMapper; - @Bean - public MultipartResolver multipartResolver(MultipartProperties multipartProperties) { - PutAwareStandardServletMultiPartResolver multipartResolver = new PutAwareStandardServletMultiPartResolver(); - multipartResolver.setResolveLazily(multipartProperties.isResolveLazily()); - return multipartResolver; - } - @Override public void configureMessageConverters(List> converters) { addDefaultHttpMessageConverters(converters);