Java 类org.apache.http.entity.mime.content.AbstractContentBody 实例源码

项目:purecloud-iot    文件:FormBodyPart.java   
/**
 * @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());
    }
}
项目:Kaspar    文件:PostRequest.java   
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");
    }
}
项目:Kaspar    文件:PostRequest.java   
public void putData(String k, AbstractContentBody v){
    data.addPart(k, v);
}
项目:Kaspar    文件:MediaWikiRequest.java   
public void setProperty(String k, AbstractContentBody v){
    data.put(k, v);
}
项目:Kaspar    文件:MediaWikiRequest.java   
public Map<String, AbstractContentBody> getProperties(){
    return data;
}