in src/main/java/org/apache/sling/servlets/post/impl/operations/StreamedUploadOperation.java [77:103]
protected void doRun(
SlingJakartaHttpServletRequest request, JakartaPostResponse response, List<Modification> changes)
throws PersistenceException {
@SuppressWarnings("unchecked")
Iterator<Part> partsIterator = (Iterator<Part>) request.getAttribute("request-parts-iterator");
Map<String, List<String>> formFields = new HashMap<>();
boolean streamingBodies = false;
while (partsIterator.hasNext()) {
Part part = partsIterator.next();
String name = part.getName();
if (isFormField(part)) {
addField(formFields, name, part);
if (streamingBodies) {
LOG.warn(
"Form field {} was sent after the bodies started to be streamed. "
+ "Will not have been available to all streamed bodies. "
+ "It is recommended to send all form fields before streamed bodies in the POST ",
name);
}
} else {
streamingBodies = true;
// process the file body and commit.
writeContent(request.getResourceResolver(), part, formFields, response, changes);
}
}
}