本文整理匯總了Java中org.apache.http.protocol.HTTP.PLAIN_TEXT_TYPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java HTTP.PLAIN_TEXT_TYPE屬性的具體用法?Java HTTP.PLAIN_TEXT_TYPE怎麽用?Java HTTP.PLAIN_TEXT_TYPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.http.protocol.HTTP
的用法示例。
在下文中一共展示了HTTP.PLAIN_TEXT_TYPE屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: StringEntity
/**
* Creates a StringEntity with the specified content, MIME type and charset
*
* @param string content to be used. Not {@code null}.
* @param mimeType MIME type to be used. May be {@code null}, in which case the default
* is {@link HTTP#PLAIN_TEXT_TYPE} i.e. "text/plain"
* @param charset character set to be used. May be {@code null}, in which case the default
* is {@link HTTP#DEF_CONTENT_CHARSET} i.e. "ISO-8859-1"
*
* @since 4.1
* @throws IllegalArgumentException if the string parameter is null
*
* @deprecated (4.1.3) use {@link #StringEntity(String, ContentType)}
*/
@Deprecated
public StringEntity(final String string, String mimeType, String charset)
throws UnsupportedEncodingException {
super();
if (string == null) {
throw new IllegalArgumentException("Source string may not be null");
}
if (mimeType == null) {
mimeType = HTTP.PLAIN_TEXT_TYPE;
}
if (charset == null) {
charset = HTTP.DEFAULT_CONTENT_CHARSET;
}
this.content = string.getBytes(charset);
setContentType(mimeType + HTTP.CHARSET_PARAM + charset);
}