本文整理汇总了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);
}