@@ -742,48 +742,32 @@ public List<String> getConnection() {
742
742
}
743
743
744
744
/**
745
- * Set the (new) value of the {@code Content-Disposition} header
746
- * for {@code form-data}.
745
+ * Set the {@code Content-Disposition} header when creating a
746
+ * {@code "multipart/form-data"} request.
747
+ * <p>Applications typically would not set this header directly but
748
+ * rather prepare a {@code MultiValueMap<String, Object>}, containing an
749
+ * Object or a {@link org.springframework.core.io.Resource} for each part,
750
+ * and then pass that to the {@code RestTemplate} or {@code WebClient}.
747
751
* @param name the control name
748
752
* @param filename the filename (may be {@code null})
749
- * @see #setContentDisposition(ContentDisposition)
750
753
* @see #getContentDisposition()
751
754
*/
752
755
public void setContentDispositionFormData (String name , @ Nullable String filename ) {
753
- setContentDispositionFormData (name , filename , null );
754
- }
755
-
756
- /**
757
- * Set the (new) value of the {@code Content-Disposition} header
758
- * for {@code form-data}, optionally encoding the filename using the RFC 5987.
759
- * <p>Only the US-ASCII, UTF-8 and ISO-8859-1 charsets are supported.
760
- * @param name the control name
761
- * @param filename the filename (may be {@code null})
762
- * @param charset the charset used for the filename (may be {@code null})
763
- * @since 4.3.3
764
- * @see #setContentDisposition(ContentDisposition)
765
- * @see #getContentDisposition()
766
- * @see <a href="https://tools.ietf.org/html/rfc7230#section-3.2.4">RFC 7230 Section 3.2.4</a>
767
- */
768
- public void setContentDispositionFormData (String name , @ Nullable String filename , @ Nullable Charset charset ) {
769
756
Assert .notNull (name , "'name' must not be null" );
770
757
ContentDisposition .Builder disposition = ContentDisposition .builder ("form-data" ).name (name );
771
758
if (filename != null ) {
772
- if (charset != null ) {
773
- disposition .filename (filename , charset );
774
- }
775
- else {
776
- disposition .filename (filename );
777
- }
759
+ disposition .filename (filename );
778
760
}
779
761
setContentDisposition (disposition .build ());
780
762
}
781
763
782
764
/**
783
- * Set the (new) value of the {@literal Content-Disposition} header. Supports the
784
- * disposition type and {@literal filename}, {@literal filename*} (encoded according
785
- * to RFC 5987, only the US-ASCII, UTF-8 and ISO-8859-1 charsets are supported),
786
- * {@literal name}, {@literal size} parameters.
765
+ * Set the {@literal Content-Disposition} header.
766
+ * <p>This could be used on a response to indicate if the content is
767
+ * expected to be displayed inline in the browser or as an attachment to be
768
+ * saved locally.
769
+ * <p>It can also be used for a {@code "multipart/form-data"} request.
770
+ * For more details see notes on {@link #setContentDispositionFormData}.
787
771
* @since 5.0
788
772
* @see #getContentDisposition()
789
773
*/
@@ -792,10 +776,7 @@ public void setContentDisposition(ContentDisposition contentDisposition) {
792
776
}
793
777
794
778
/**
795
- * Return the {@literal Content-Disposition} header parsed as a {@link ContentDisposition}
796
- * instance. Supports the disposition type and {@literal filename}, {@literal filename*}
797
- * (encoded according to RFC 5987, only the US-ASCII, UTF-8 and ISO-8859-1 charsets are
798
- * supported), {@literal name}, {@literal size} parameters.
779
+ * Return a parsed representation of the {@literal Content-Disposition} header.
799
780
* @since 5.0
800
781
* @see #setContentDisposition(ContentDisposition)
801
782
*/
0 commit comments