use of org.springframework.web.multipart.support.StandardMultipartHttpServletRequest in project spring-framework by spring-projects.
the class MockMultipartHttpServletRequestBuilder method createServletRequest.
/**
* Create a new {@link MockMultipartHttpServletRequest} based on the
* supplied {@code ServletContext} and the {@code MockMultipartFiles}
* added to this builder.
*/
@Override
protected final MockHttpServletRequest createServletRequest(ServletContext servletContext) {
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(servletContext);
this.files.stream().forEach(request::addFile);
this.parts.values().stream().flatMap(Collection::stream).forEach(request::addPart);
if (!this.parts.isEmpty()) {
new StandardMultipartHttpServletRequest(request).getMultiFileMap().values().stream().flatMap(Collection::stream).forEach(request::addFile);
}
return request;
}
Aggregations