代码在org.apache.http.entity.StringEntity中。版本4.2.2。
感觉代码和注释不匹配。
同时,没有处理好contentType为null的情况。
4.2.3中无该问题。已经修复。
/**
* Creates a StringEntity with the specified content and content type.
*
* @param string content to be used. Not {@code null}.
* @param contentType content type to be used. May be {@code null}, in which case the default
* MIME type {@link ContentType#TEXT_PLAIN} is assumed.
*
* @throws IllegalArgumentException if the string parameter is null
*
* @since 4.2
*/
public StringEntity(final String string, final ContentType contentType) {
super();
if (string == null) {
throw new IllegalArgumentException("Source string may not be null");
}
Charset charset = contentType != null ? contentType.getCharset() : null;
try {
this.content = string.getBytes(charset.name());
} catch (UnsupportedEncodingException ex) {
// should never happen
throw new UnsupportedCharsetException(charset.name());
}
if (contentType != null) {
setContentType(contentType.toString());
}
}
分享到:
相关推荐
org.apache.http包 httpcore-4.2.2.jar ...两个都是4.2.3版本里的,core显示是4.2.2 我自己只用到这两个。 完整的里面还有几个jar 名称是httpcomponents-client-4.2.3包含英文文档,可去官网下载
pom.xml配置 ...mvn install:install-file -DgroupId=org.springside -DartifactId=springside-core -Dversion=4.2.2.GA -Dfile=./springside-core-4.2.2.GA.jar -Dpackaging=jar -DgeneratePom=true
springside-core-4.2.2是spring,springMVC入门和学习的好东西。
springside-core-4.2.2.GA.jar 包,需要的可以自行下载,
springside-core-4.2.2.GA.jar 亲测可用
httpmime-4.2.3、httpcore-4.2.2、httpclient-4.2.3 jar包
springside-core-4.2.2.GA 学习spring springMVC 必备架包
springside-core-4.2.2.GA-tests.jar
文件名:httpcomponents-client-4.2.2-bin.tar.gz ...commons-codec-1.6.jar commons-logging-1.1.1.jar fluent-hc-4.2.2.jar httpclient-4.2.2.jar httpclient-cache-4.2.2.jar httpcore-4.2.2.jar httpmime-4.2.2.jar
hibernate 框架hibernate-core-4.2.2.Final.jar 包
httpclient4.2.2.zip
springside-core-4.2.2.GA.pom springside-core-4.2.2.GA.pomspringside-core-4.2.2.GA.pomspringside-core-4.2.2.GA.pomspringside-core-4.2.2.GA.pom
赠送jar包:spring-core-4.2.2.RELEASE.jar; 赠送原API文档:spring-core-4.2.2.RELEASE-javadoc.jar; 赠送源代码:spring-core-4.2.2.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-core-4.2.2.RELEASE....
赠送jar包:spring-core-4.2.2.RELEASE.jar; 赠送原API文档:spring-core-4.2.2.RELEASE-javadoc.jar; 赠送源代码:spring-core-4.2.2.RELEASE-sources.jar; 赠送Maven依赖信息文件:spring-core-4.2.2.RELEASE....
spring-core-4.2.2.RELEASE.jar (spring 4.4.2的核心jar包),Java开发中spring框架开发必须的依赖包。
它提供了一个共享平台,使不同供应商开发的软件模块可以在不同的汽车平台上进行集成和交换。 AutoSAR标准协议规范4.2.2,里面包含了AutoSAR组织所规定的AutoSAR架构的标准规范协议原文档。对AutoSAR的学习有一定的...
metrics-core-4.2.2
Mac 版 android-studio(v4.2.2), 官方渠道下载
CAS server 4.2.2源码