Package com.foxinmy.weixin4j.http
Class ContentType
- java.lang.Object
-
- com.foxinmy.weixin4j.http.ContentType
-
- All Implemented Interfaces:
Serializable
public final class ContentType extends Object implements Serializable
reference of apache pivot- Since:
- JDK 1.6
- Author:
- jinyu(foxinmy@gmail.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ContentType
APPLICATION_FORM_URLENCODED
static ContentType
APPLICATION_JSON
static ContentType
DEFAULT_BINARY
static ContentType
DEFAULT_TEXT
static ContentType
MULTIPART_FORM_DATA
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContentType
create(MimeType mimeType, Charset charset)
static ContentType
create(String mimeType)
static ContentType
create(String mimeType, NameValue... params)
Creates a new instance ofContentType
with the given parameters.static ContentType
create(String mimeType, String charset)
static ContentType
create(String mimeType, Charset charset)
Charset
getCharset()
MimeType
getMimeType()
String
getParameter(String name)
String
toString()
Generates textual representation of this content type which can be used as the value of aContent-Type
header.static String
toString(List<ContentType> contentTypes)
ContentType
withParameters(NameValue... params)
Creates a new instance with this MIME type and the given parameters.
-
-
-
Field Detail
-
APPLICATION_JSON
public static final ContentType APPLICATION_JSON
-
APPLICATION_FORM_URLENCODED
public static final ContentType APPLICATION_FORM_URLENCODED
-
MULTIPART_FORM_DATA
public static final ContentType MULTIPART_FORM_DATA
-
DEFAULT_BINARY
public static final ContentType DEFAULT_BINARY
-
DEFAULT_TEXT
public static final ContentType DEFAULT_TEXT
-
-
Method Detail
-
getMimeType
public MimeType getMimeType()
-
getCharset
public Charset getCharset()
-
toString
public String toString()
Generates textual representation of this content type which can be used as the value of aContent-Type
header.
-
toString
public static String toString(List<ContentType> contentTypes)
-
create
public static ContentType create(MimeType mimeType, Charset charset)
-
create
public static ContentType create(String mimeType)
-
create
public static ContentType create(String mimeType, String charset) throws UnsupportedCharsetException
- Throws:
UnsupportedCharsetException
-
create
public static ContentType create(String mimeType, Charset charset)
-
create
public static ContentType create(String mimeType, NameValue... params) throws UnsupportedCharsetException
Creates a new instance ofContentType
with the given parameters.- Parameters:
mimeType
- MIME type. It may not benull
or empty. It may not contain characters<">, <;>, <,>
reserved by the HTTP specification.params
- parameters.- Returns:
- content type
- Throws:
UnsupportedCharsetException
- Since:
- 4.4
-
withParameters
public ContentType withParameters(NameValue... params) throws UnsupportedCharsetException
Creates a new instance with this MIME type and the given parameters.- Parameters:
params
-- Returns:
- a new instance with this MIME type and the given parameters.
- Throws:
UnsupportedCharsetException
- Since:
- 4.4
-
-