diff --git a/aws-serverless-java-container-core/pom.xml b/aws-serverless-java-container-core/pom.xml
index 9d8b5a138..26bafa9a3 100644
--- a/aws-serverless-java-container-core/pom.xml
+++ b/aws-serverless-java-container-core/pom.xml
@@ -67,9 +67,9 @@
- org.apache.commons
- commons-fileupload2
- 2.0-SNAPSHOT
+ commons-io
+ commons-io
+ 2.11.0
diff --git a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java
index 99b2782c5..44fd84a96 100644
--- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java
+++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java
@@ -22,11 +22,6 @@
import com.amazonaws.serverless.proxy.model.MultiValuedTreeMap;
import com.amazonaws.services.lambda.runtime.Context;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import org.apache.commons.fileupload2.FileItem;
-import org.apache.commons.fileupload2.FileUploadException;
-import org.apache.commons.fileupload2.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload2.jaksrvlt.JakSrvltFileUpload;
-import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.NullInputStream;
import org.slf4j.Logger;
@@ -508,39 +503,7 @@ protected Map> getFormUrlEncodedParametersMap() {
@SuppressFBWarnings({"FILE_UPLOAD_FILENAME", "WEAK_FILENAMEUTILS"})
protected Map getMultipartFormParametersMap() {
- if (multipartFormParameters != null) {
- return multipartFormParameters;
- }
- if (!JakSrvltFileUpload.isMultipartContent(this)) { // isMultipartContent also checks the content type
- multipartFormParameters = new HashMap<>();
- return multipartFormParameters;
- }
- Timer.start("SERVLET_REQUEST_GET_MULTIPART_PARAMS");
- multipartFormParameters = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
-
- JakSrvltFileUpload upload = new JakSrvltFileUpload(new DiskFileItemFactory());
-
- try {
- List items = upload.parseRequest(this);
- for (FileItem item : items) {
- String fileName = FilenameUtils.getName(item.getName());
- AwsProxyRequestPart newPart = new AwsProxyRequestPart(item.get());
- newPart.setName(item.getFieldName());
- newPart.setSubmittedFileName(fileName);
- newPart.setContentType(item.getContentType());
- newPart.setSize(item.getSize());
- item.getHeaders().getHeaderNames().forEachRemaining(h -> {
- newPart.addHeader(h, item.getHeaders().getHeader(h));
- });
-
- multipartFormParameters.put(item.getFieldName(), newPart);
- }
- } catch (FileUploadException e) {
- Timer.stop("SERVLET_REQUEST_GET_MULTIPART_PARAMS");
- log.error("Could not read multipart upload file", e);
- }
- Timer.stop("SERVLET_REQUEST_GET_MULTIPART_PARAMS");
- return multipartFormParameters;
+ throw new UnsupportedOperationException();
}
protected String[] getQueryParamValues(MultiValuedTreeMap qs, String key, boolean isCaseSensitive) {
diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java
index 79bfa6cd3..efe32ba2a 100644
--- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java
+++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequestFormTest.java
@@ -7,7 +7,8 @@
import org.apache.commons.io.IOUtils;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;;
+import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import jakarta.servlet.ServletException;
@@ -51,6 +52,7 @@ public class AwsProxyHttpServletRequestFormTest {
.build();
private static final String ENCODED_FORM_ENTITY = PART_KEY_1 + "=" + ENCODED_VALUE + "&" + PART_KEY_2 + "=" + PART_VALUE_2;
+ @Disabled("Disabled until new release of commons-fileupload based on Jakarta APIs")
@Test
void postForm_getParam_getEncodedFullValue() {
try {
@@ -67,6 +69,7 @@ void postForm_getParam_getEncodedFullValue() {
}
}
+ @Disabled("Disabled until new release of commons-fileupload based on Jakarta APIs")
@Test
void postForm_getParts_parsing() {
try {
@@ -86,6 +89,7 @@ void postForm_getParts_parsing() {
}
}
+ @Disabled("Disabled until new release of commons-fileupload based on Jakarta APIs")
@Test
void multipart_getParts_binary() {
try {
diff --git a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java
index 9df66a891..725fada8f 100644
--- a/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java
+++ b/aws-serverless-java-container-core/src/test/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java
@@ -155,12 +155,7 @@ public AwsProxyRequestBuilder form(String key, String value) {
}
public AwsProxyRequestBuilder formFilePart(String fieldName, String fileName, byte[] content) throws IOException {
- if (multipartBuilder == null) {
- multipartBuilder = MultipartEntityBuilder.create();
- }
- multipartBuilder.addPart(fieldName, new ByteArrayBody(content, fileName));
- buildMultipartBody();
- return this;
+ throw new UnsupportedOperationException();
}
public AwsProxyRequestBuilder formTextFieldPart(String fieldName, String fieldValue)
diff --git a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java
index 9dc1ab32a..6c575da6c 100644
--- a/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java
+++ b/aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey/JerseyParamEncodingTest.java
@@ -263,6 +263,7 @@ void queryParam_listOfString_expectCorrectLength(String reqType) {
validateSingleValueModel(resp, "3");
}
+ @Disabled("Disabled until new release of commons-fileupload based on Jakarta APIs")
@MethodSource("data")
@ParameterizedTest
void multipart_getFileSize_expectCorrectLength(String reqType)
diff --git a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java
index 1101efc8c..f78d43812 100644
--- a/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java
+++ b/aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringAwsProxyTest.java
@@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.binary.Base64;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.springframework.web.servlet.DispatcherServlet;
@@ -468,6 +469,7 @@ void contextPath_generateLink_returnsCorrectPath(String reqType) {
SpringLambdaContainerHandler.getContainerConfig().setUseStageAsServletContext(false);
}
+ @Disabled("Disabled until new release of commons-fileupload based on Jakarta APIs")
@MethodSource("data")
@ParameterizedTest
void multipart_getFileName_returnsCorrectFileName(String reqType)