/** * @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()); } }
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"); } }
public void putData(String k, AbstractContentBody v){ data.addPart(k, v); }
public void setProperty(String k, AbstractContentBody v){ data.put(k, v); }
public Map<String, AbstractContentBody> getProperties(){ return data; }