Skip to content

Commit 3b00e72

Browse files
committed
moved getParts and getPart to AwsHttpServletRequest
1 parent 397cd9d commit 3b00e72

File tree

3 files changed

+21
-43
lines changed

3 files changed

+21
-43
lines changed

aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpApiV2ProxyHttpServletRequest.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,6 @@ public void logout() throws ServletException {
235235
throw new UnsupportedOperationException();
236236
}
237237

238-
@Override
239-
public Collection<Part> getParts() throws IOException, ServletException {
240-
List<Part> partList =
241-
getMultipartFormParametersMap().values().stream()
242-
.flatMap(List::stream)
243-
.collect(Collectors.toList());
244-
return partList;
245-
}
246-
247-
@Override
248-
public Part getPart(String s) throws IOException, ServletException {
249-
// In case there's multiple files with the same fieldName, we return the first one in the list
250-
List<Part> values = getMultipartFormParametersMap().get(s);
251-
if (Objects.isNull(values)) {
252-
return null;
253-
}
254-
return getMultipartFormParametersMap().get(s).get(0);
255-
}
256-
257238
@Override
258239
public <T extends HttpUpgradeHandler> T upgrade(Class<T> aClass) throws IOException, ServletException {
259240
throw new UnsupportedOperationException();

aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletRequest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,27 @@ protected Map<String, List<String>> getFormUrlEncodedParametersMap() {
510510
return urlEncodedFormParameters;
511511
}
512512

513+
@Override
514+
public Collection<Part> getParts()
515+
throws IOException, ServletException {
516+
List<Part> partList =
517+
getMultipartFormParametersMap().values().stream()
518+
.flatMap(List::stream)
519+
.collect(Collectors.toList());
520+
return partList;
521+
}
522+
523+
@Override
524+
public Part getPart(String s)
525+
throws IOException, ServletException {
526+
// In case there's multiple files with the same fieldName, we return the first one in the list
527+
List<Part> values = getMultipartFormParametersMap().get(s);
528+
if (Objects.isNull(values)) {
529+
return null;
530+
}
531+
return getMultipartFormParametersMap().get(s).get(0);
532+
}
533+
513534
@SuppressFBWarnings({"FILE_UPLOAD_FILENAME", "WEAK_FILENAMEUTILS"})
514535
protected Map<String, List<Part>> getMultipartFormParametersMap() {
515536
if (multipartFormParameters != null) {

aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -255,30 +255,6 @@ public void logout()
255255
throw new UnsupportedOperationException();
256256
}
257257

258-
259-
@Override
260-
public Collection<Part> getParts()
261-
throws IOException, ServletException {
262-
List<Part> partList =
263-
getMultipartFormParametersMap().values().stream()
264-
.flatMap(List::stream)
265-
.collect(Collectors.toList());
266-
return partList;
267-
}
268-
269-
270-
@Override
271-
public Part getPart(String s)
272-
throws IOException, ServletException {
273-
// In case there's multiple files with the same fieldName, we return the first one in the list
274-
List<Part> values = getMultipartFormParametersMap().get(s);
275-
if (Objects.isNull(values)) {
276-
return null;
277-
}
278-
return getMultipartFormParametersMap().get(s).get(0);
279-
}
280-
281-
282258
@Override
283259
public <T extends HttpUpgradeHandler> T upgrade(Class<T> aClass)
284260
throws IOException, ServletException {

0 commit comments

Comments
 (0)