Package de.xima.fc.http
Class ContentDisposition
- java.lang.Object
-
- de.xima.fc.http.ContentDisposition
-
public final class ContentDisposition extends Object
Class for working with theContent-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
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTACHMENT
Constant for the content disposition typeattachment
.
static String
INLINE
Constant for the content disposition typeinline
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Charset
getCharset()
Gets the charset defined in filename* parameter, if present, ornull
if not defined.String
getFileName()
Gets the filename, either from thefilename
orfilename*
directive, if present, or the empty string otherwise.String
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.String
getType()
Gets the content disposition type, usually eitherattachment
orinline
.static ContentDisposition
parseHeaderValue(String contentDispositionHeader)
Parses a Content-Disposition header value, such as
-
-
-
Field Detail
-
ATTACHMENT
public static final String ATTACHMENT
Constant for the content disposition typeattachment
.
- See Also:
- Constant Field Values
-
INLINE
public static final String INLINE
Constant for the content disposition typeinline
.
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCharset
public Charset getCharset()
Gets the charset defined in filename* parameter, if present, ornull
if not defined.- Returns:
- The charset defined in filename* parameter.
-
getFileName
public String getFileName()
Gets the filename, either from thefilename
orfilename*
directive, if present, or the empty string otherwise.- Returns:
- The file name.
- See Also:
getFileName()
-
getName
public String 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
public String getType()
Gets the content disposition type, usually eitherattachment
orinline
.- Returns:
- The content disposition type.
-
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.
-
-