Class ContentDisposition.Builder
- Enclosing class:
- ContentDisposition
Composes the disposition-type and parameters defined by
RFC 6266 into the
param(String, String) is a generic escape hatch. Setters overwrite a previously-set parameter of the
same name while preserving its original position.
Example:
String
See Also:
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the disposition-type toattachment .build()Builds the renderedContent-Disposition header value.creationDate(String value) Sets thecreation-date parameter (rendered as a quoted HTTP-date).Sets thefilename parameter (rendered as a quoted-string with backslash/quote escaping).filenameExt(String value) Sets thefilename* parameter (rendered as a raw RFC 5987 ext-value, unquoted).formData()Sets the disposition-type toform-data .inline()Sets the disposition-type toinline .modificationDate(String value) Sets themodification-date parameter (rendered as a quoted HTTP-date).Sets thename parameter (rendered as a quoted-string).Generic escape hatch for setting any parameter by name, rendered as a quoted-string.Sets theread-date parameter (rendered as a quoted HTTP-date).size(long value) Sets thesize parameter (rendered as a bare number).toHeader()Builds aContentDispositionheader bean directly from this builder.toString()Sets the disposition-type (e.g.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
type
Sets the disposition-type (e.g."inline" ,"attachment" ,"form-data" ).- Parameters:
value- The disposition-type. Must not benull or blank.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueisnull or blank.
-
inline
Sets the disposition-type toinline .- Returns:
- This object.
-
attachment
Sets the disposition-type toattachment .- Returns:
- This object.
-
formData
Sets the disposition-type toform-data .- Returns:
- This object.
-
name
Sets thename parameter (rendered as a quoted-string).- Parameters:
value- The field name. Must not benull .- Returns:
- This object.
-
filename
Sets thefilename parameter (rendered as a quoted-string with backslash/quote escaping).- Parameters:
value- The filename. Must not benull .- Returns:
- This object.
-
filenameExt
Sets thefilename* parameter (rendered as a raw RFC 5987 ext-value, unquoted).- Parameters:
value- The encoded ext-value (e.g."UTF-8''%e2%82%ac%20rates" ). Must not benull .- Returns:
- This object.
-
creationDate
Sets thecreation-date parameter (rendered as a quoted HTTP-date).- Parameters:
value- The creation date. Must not benull .- Returns:
- This object.
-
modificationDate
Sets themodification-date parameter (rendered as a quoted HTTP-date).- Parameters:
value- The modification date. Must not benull .- Returns:
- This object.
-
readDate
Sets theread-date parameter (rendered as a quoted HTTP-date).- Parameters:
value- The read date. Must not benull .- Returns:
- This object.
-
size
Sets thesize parameter (rendered as a bare number).- Parameters:
value- The size in bytes. Must be non-negative.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueis negative.
-
param
Generic escape hatch for setting any parameter by name, rendered as a quoted-string.Replaces any previously-registered value for the same parameter while preserving its original position.
- Parameters:
name- The parameter name. Must not benull or blank.value- The parameter value (quoted automatically). Must not benull .- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifnameisnull or blank.
-
build
Builds the renderedContent-Disposition header value.Returns an empty string when no disposition-type or parameters have been registered.
- Returns:
- The header value. Never
null .
-
toHeader
Builds aContentDispositionheader bean directly from this builder.- Returns:
- A
ContentDispositioncarryingbuild(). Nevernull .
-
toString
-