在Java中,ContentDisposition
类通常指的是用于表示HTTP响应中Content-Disposition
头的类。这个类并不是Java标准库的一部分,而是可能存在于某些第三方库或框架中,用于处理和解析Content-Disposition
头。
Content-Disposition
头用于指示MIME消息(如HTTP响应)中实体内容的意图。它通常用于指定下载文件时的文件名,或者指示内容是否应该直接在浏览器中显示。Content-Disposition
头可以包含一个filename
参数,用于建议下载文件的名称。
如果ContentDisposition
类存在于某个特定的库中,那么该类可能会提供以下功能:
- 构造函数:允许你根据
Content-Disposition
头的值创建一个ContentDisposition
对象。 - 获取和设置参数:提供方法来获取和设置
Content-Disposition
头中的各种参数,如filename
。 - 解析
Content-Disposition
头:提供方法来分析Content-Disposition
头的字符串表示形式,并提取相关参数。 - 生成
Content-Disposition
头的字符串表示:提供方法将ContentDisposition
对象转换为其对应的HTTP头字符串。
请注意,由于ContentDisposition
类不是Java标准库的一部分,你需要查找包含此类定义的特定库或框架。在实际应用中,你可能需要查看你所使用的HTTP客户端或服务器库是否提供了这样的类或接口来处理Content-Disposition
头。
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev Class
Next Class
Frames
No Frames
Summary:
Nested |
Field |
Constr |
Method
Detail:
Field |
Constr |
Method
javax.mail.internet
Class ContentDisposition
java.lang.Object
javax.mail.internet.ContentDisposition
public class ContentDisposition
extends Object
This class represents a MIME ContentDisposition value. It provides methods to parse a ContentDisposition string into individual components and to generate a MIME style ContentDisposition string.
Author:
John Mani
Constructor Summary
Constructors Constructor and Description
ContentDisposition()
No-arg Constructor.
ContentDisposition(String s)
Constructor that takes a ContentDisposition string.
ContentDisposition(String disposition, ParameterList list)
Constructor.
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description
String getDisposition()
Return the disposition value.
String getParameter(String name)
Return the specified parameter value.
ParameterList getParameterList()
Return a ParameterList object that holds all the available parameters.
void setDisposition(String disposition)
Set the disposition.
void setParameter(String name, String value)
Set the specified parameter.
void setParameterList(ParameterList list)
Set a new ParameterList.
String toString()
Retrieve a RFC2045 style string representation of this ContentDisposition.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Constructor Detail
ContentDisposition
public ContentDisposition()
No-arg Constructor.
ContentDisposition
public ContentDisposition(String disposition,
ParameterList list)
Constructor.
Parameters:
disposition - disposition
list - ParameterList
Since:
JavaMail 1.2
ContentDisposition
public ContentDisposition(String s)
throws ParseException
Constructor that takes a ContentDisposition string. The String is parsed into its constituents: dispostion and parameters. A ParseException is thrown if the parse fails.
Parameters:
s - the ContentDisposition string.
Throws:
ParseException - if the parse fails.
Since:
JavaMail 1.2
Method Detail
getDisposition
public String getDisposition()
Return the disposition value.
Returns:
the disposition
Since:
JavaMail 1.2
getParameter
public String getParameter(String name)
Return the specified parameter value. Returns null if this parameter is absent.
Parameters:
name - the parameter name
Returns:
parameter value
Since:
JavaMail 1.2
getParameterList
public ParameterList getParameterList()
Return a ParameterList object that holds all the available parameters. Returns null if no parameters are available.
Returns:
ParameterList
Since:
JavaMail 1.2
setDisposition
public void setDisposition(String disposition)
Set the disposition. Replaces the existing disposition.
Parameters:
disposition - the disposition
Since:
JavaMail 1.2
setParameter
public void setParameter(String name,
String value)
Set the specified parameter. If this parameter already exists, it is replaced by this new value.
Parameters:
name - parameter name
value - parameter value
Since:
JavaMail 1.2
setParameterList
public void setParameterList(ParameterList list)
Set a new ParameterList.
Parameters:
list - ParameterList
Since:
JavaMail 1.2
toString
public String toString()
Retrieve a RFC2045 style string representation of this ContentDisposition. Returns an empty string if the conversion failed.
Overrides:
toString in class Object
Returns:
RFC2045 style string
Since:
JavaMail 1.2
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev Class
Next Class
Frames
No Frames
Summary:
Nested |
Field |
Constr |
Method
Detail:
Field |
Constr |
Method
Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.