Skip to content

Commit 3612990

Browse files
committed
Polishing
1 parent dea2029 commit 3612990

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

spring-web/src/main/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriter.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.http.codec.multipart;
1818

19-
import java.nio.charset.Charset;
2019
import java.util.ArrayList;
2120
import java.util.Arrays;
2221
import java.util.Collections;
@@ -146,17 +145,6 @@ public HttpMessageWriter<MultiValueMap<String, String>> getFormWriter() {
146145
return this.formWriter;
147146
}
148147

149-
/**
150-
* Set the character set to use for part headers such as
151-
* "Content-Disposition" (and its filename parameter).
152-
* <p>By default this is set to "UTF-8". If changed from this default,
153-
* the "Content-Type" header will have a "charset" parameter that specifies
154-
* the character set used.
155-
*/
156-
public void setCharset(Charset charset) {
157-
Assert.notNull(charset, "Charset must not be null");
158-
this.charset = charset;
159-
}
160148

161149

162150
@Override

spring-web/src/main/java/org/springframework/http/codec/multipart/MultipartWriterSupport.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.springframework.http.MediaType;
3131
import org.springframework.http.codec.LoggingCodecSupport;
3232
import org.springframework.lang.Nullable;
33+
import org.springframework.util.Assert;
3334
import org.springframework.util.MimeTypeUtils;
3435
import org.springframework.util.MultiValueMap;
3536

@@ -44,9 +45,9 @@ public class MultipartWriterSupport extends LoggingCodecSupport {
4445
/** THe default charset used by the writer. */
4546
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
4647

47-
protected final List<MediaType> supportedMediaTypes;
48+
private final List<MediaType> supportedMediaTypes;
4849

49-
protected Charset charset = DEFAULT_CHARSET;
50+
private Charset charset = DEFAULT_CHARSET;
5051

5152

5253
/**
@@ -64,6 +65,18 @@ public Charset getCharset() {
6465
return this.charset;
6566
}
6667

68+
/**
69+
* Set the character set to use for part headers such as
70+
* "Content-Disposition" (and its filename parameter).
71+
* <p>By default this is set to "UTF-8". If changed from this default,
72+
* the "Content-Type" header will have a "charset" parameter that specifies
73+
* the character set used.
74+
*/
75+
public void setCharset(Charset charset) {
76+
Assert.notNull(charset, "Charset must not be null");
77+
this.charset = charset;
78+
}
79+
6780
public List<MediaType> getWritableMediaTypes() {
6881
return this.supportedMediaTypes;
6982
}

0 commit comments

Comments
 (0)