Class ContentDisposition
java.lang.Object
de.xima.fc.http.ContentDisposition
Class for working with the
Content-Disposition. Handles Unicode filenames properly, such as e.g.
Content-Disposition: attachment; filename*=UTF-8''foo%E9%A3%9F%E3%81%B9%E3%81%BE%E3%81%97%E3%81%9Fbar.bin; filename="foo___bar.bin"
- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ContentDisposition.BuilderCreates a new builder for a content disposition with the given type.static StringformatHeaderValue(ContentDisposition disposition) Creates an HTTP header value for the given content disposition.Gets the charset defined in filename* parameter, if present, ornullif not defined.Gets the filename, either from thefilenameorfilename*directive, if present, or the empty string otherwise.getName()Gets the name of the HTML field in the form that the content of this sub part refers to, if present, of the empty string otherwise.getType()Gets the content disposition type, usually eitherattachmentorinline.static ContentDispositionparseHeaderValue(String contentDispositionHeader) Parses a Content-Disposition header value, such as
-
Field Details
-
ATTACHMENT
Constant for the content disposition typeattachment.- See Also:
-
INLINE
-
-
Method Details
-
getCharset
Gets the charset defined in filename* parameter, if present, ornullif not defined.- Returns:
- The charset defined in filename* parameter.
-
getFileName
Gets the filename, either from thefilenameorfilename*directive, if present, or the empty string otherwise.- Returns:
- The file name.
- See Also:
-
getName
Gets the name of the HTML field in the form that the content of this sub part refers to, if present, of the empty string otherwise.- Returns:
- The name of the HTML field.
-
getType
Gets the content disposition type, usually eitherattachmentorinline.- Returns:
- The content disposition type.
-
builder
Creates a new builder for a content disposition with the given type.- Parameters:
type- The type of the content disposition, usually eitherattachmentorinline.- Returns:
- The new builder.
-
formatHeaderValue
Creates an HTTP header value for the given content disposition. Can be used e.g. for a Content-Disposition header.- Parameters:
disposition- The content disposition- Returns:
- The HTTP header value
-
parseHeaderValue
public static ContentDisposition parseHeaderValue(String contentDispositionHeader) throws ContentDispositionParseException Parses a Content-Disposition header value, such asContent-Disposition: attachment; filename*=UTF-8''foo%E9%A3%9F%E3%81%B9%E3%81%BE%E3%81%97%E3%81%9Fbar.bin; filename="foo___bar.bin"
- Parameters:
contentDispositionHeader- Header to parse.- Returns:
- The parsed header.
- Throws:
ContentDispositionParseException- When the header value is invalid.
-