本文整理汇总了Java中org.apache.http.entity.mime.content.AbstractContentBody类的典型用法代码示例。如果您正苦于以下问题:Java AbstractContentBody类的具体用法?Java AbstractContentBody怎么用?Java AbstractContentBody使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractContentBody类属于org.apache.http.entity.mime.content包,在下文中一共展示了AbstractContentBody类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateContentType
import org.apache.http.entity.mime.content.AbstractContentBody; //导入依赖的package包/类
/**
* @deprecated (4.4) use {@link org.apache.http.entity.mime.FormBodyPartBuilder}.
*/
@Deprecated
protected void generateContentType(final ContentBody body) {
final ContentType contentType;
if (body instanceof AbstractContentBody) {
contentType = ((AbstractContentBody) body).getContentType();
} else {
contentType = null;
}
if (contentType != null) {
addField(MIME.CONTENT_TYPE, contentType.toString());
} else {
final StringBuilder buffer = new StringBuilder();
buffer.append(body.getMimeType()); // MimeType cannot be null
if (body.getCharset() != null) { // charset may legitimately be null
buffer.append("; charset=");
buffer.append(body.getCharset());
}
addField(MIME.CONTENT_TYPE, buffer.toString());
}
}
示例2: putData
import org.apache.http.entity.mime.content.AbstractContentBody; //导入依赖的package包/类
public void putData(Map<? extends String, ?> m) throws UnsupportedEncodingException{
for(Entry<? extends String, ?> e : m.entrySet()){
if(e.getValue() instanceof java.lang.String)
putData(e.getKey(), (String)e.getValue());
else if(e.getValue() instanceof AbstractContentBody)
putData(e.getKey(), (AbstractContentBody)e.getValue());
else
throw new IllegalArgumentException(e.getValue().getClass().getCanonicalName()+" isn't supported as http multipart value");
}
}
示例3: setProperty
import org.apache.http.entity.mime.content.AbstractContentBody; //导入依赖的package包/类
public void setProperty(String k, AbstractContentBody v){
data.put(k, v);
}
示例4: getProperties
import org.apache.http.entity.mime.content.AbstractContentBody; //导入依赖的package包/类
public Map<String, AbstractContentBody> getProperties(){
return data;
}