I am new to AWS Lambda and I am trying to implement a Lambda function that receives a POST request containing data encoded as multipart / form-data. The message is received through the API gateway using Lambda Proxy integration and the body is encoded in Base64 when it arrives at the Lambda function. After decoding it manually, I see that it contains a multi-part body, similar to the following:
-----WebKitFormBoundary3EZ0C3tbP2JpAmz4
Content-Disposition: form-data; name="param1"
value1
-----WebKitFormBoundary3EZ0C3tbP2JpAmz4
Content-Disposition: form-data; name="param2"
value2
------WebKitFormBoundary3EZ0C3tbP2JpAmz4
Content-Disposition: form-data; name="myfile"; filename="ivr.png"
Content-Type: image/png
PNG
... [binary stuff]
------WebKitFormBoundary3EZ0C3tbP2JpAmz4--
java 8, . , + javax.mail.Multipart +, , , "name" , , . "param1" "param2".
, , ...
-? , (base64 - , ):
DataSource source = new ByteArrayDataSource(new ByteArrayInputStream(Base64.decodeBase64(base64)), "multipart/mixed");
MimeMultipart mp = new MimeMultipart(source);
, .