From d2b10048b926c8337b9d1d1b7a23a92d3ab94d77 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Fri, 4 Sep 2009 21:22:17 +0000 Subject: [PATCH] HTTPCLIENT-874: Override method MultipartEntity.addPart so that applications may use FormBodyPart Contributed by Gerald Turner git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@811556 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/entity/mime/MultipartEntity.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java b/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java index 9949f6c91..4f95f3bcc 100644 --- a/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java +++ b/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntity.java @@ -43,6 +43,7 @@ import org.apache.http.entity.mime.content.ContentBody; import org.apache.http.message.BasicHeader; import org.apache.http.protocol.HTTP; import org.apache.james.mime4j.field.Fields; +import org.apache.james.mime4j.message.BodyPart; import org.apache.james.mime4j.message.Message; /** @@ -121,11 +122,18 @@ public class MultipartEntity implements HttpEntity { return buffer.toString(); } - public void addPart(final String name, final ContentBody contentBody) { - this.multipart.addBodyPart(new FormBodyPart(name, contentBody)); + /** + * @since 4.1 + */ + public void addPart(final BodyPart bodyPart) { + this.multipart.addBodyPart(bodyPart); this.dirty = true; } - + + public void addPart(final String name, final ContentBody contentBody) { + addPart(new FormBodyPart(name, contentBody)); + } + public boolean isRepeatable() { List parts = this.multipart.getBodyParts(); for (Iterator it = parts.iterator(); it.hasNext(); ) {