Remove optional javax.mail dependency from WebFlux

The MultipartHttpMessageWriter now directly encodes part header values
defaulting to UTF-8 and also specifies the charset in the
Content-Type header for the entire request.

This should work with something commonly used like Apache Commons
FileUpload which checks request.getCharacterEncoding() and uses it
for reading headers.
This commit is contained in:
Rossen Stoyanchev
2017-05-04 13:04:04 -04:00
parent a56f735edd
commit bb744574e5
4 changed files with 29 additions and 56 deletions

View File

@@ -101,7 +101,7 @@ public class MultipartHttpMessageWriterTests {
Map<String, Object> hints = Collections.emptyMap();
this.writer.write(Mono.just(map), null, MediaType.MULTIPART_FORM_DATA, response, hints).block();
final MediaType contentType = response.getHeaders().getContentType();
MediaType contentType = response.getHeaders().getContentType();
assertNotNull("No boundary found", contentType.getParameter("boundary"));
// see if Synchronoss NIO Multipart can read what we wrote
@@ -109,7 +109,7 @@ public class MultipartHttpMessageWriterTests {
MultipartHttpMessageReader reader = new MultipartHttpMessageReader(synchronossReader);
MockServerHttpRequest request = MockServerHttpRequest.post("/foo")
.header(HttpHeaders.CONTENT_TYPE, contentType.toString())
.contentType(MediaType.parseMediaType(contentType.toString()))
.body(response.getBody());
ResolvableType elementType = ResolvableType.forClassWithGenerics(MultiValueMap.class, String.class, Part.class);