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 ContentTypeAPPLICATION_FORM_URLENCODEDstatic ContentTypeAPPLICATION_JSONstatic ContentTypeDEFAULT_BINARYstatic ContentTypeDEFAULT_TEXTstatic ContentTypeMULTIPART_FORM_DATA
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ContentTypecreate(MimeType mimeType, Charset charset)static ContentTypecreate(String mimeType)static ContentTypecreate(String mimeType, NameValue... params)Creates a new instance ofContentTypewith the given parameters.static ContentTypecreate(String mimeType, String charset)static ContentTypecreate(String mimeType, Charset charset)CharsetgetCharset()MimeTypegetMimeType()StringgetParameter(String name)StringtoString()Generates textual representation of this content type which can be used as the value of aContent-Typeheader.static StringtoString(List<ContentType> contentTypes)ContentTypewithParameters(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-Typeheader.
-
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 ofContentTypewith the given parameters.- Parameters:
mimeType- MIME type. It may not benullor 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
-
-