Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8240A2009F8 for ; Fri, 3 Jun 2016 21:49:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 80DE7160A49; Fri, 3 Jun 2016 19:49:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A0D8F160A3B for ; Fri, 3 Jun 2016 21:49:49 +0200 (CEST) Received: (qmail 74712 invoked by uid 500); 3 Jun 2016 19:49:48 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 74700 invoked by uid 99); 3 Jun 2016 19:49:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jun 2016 19:49:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C90A41A0920 for ; Fri, 3 Jun 2016 19:49:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.802 X-Spam-Level: X-Spam-Status: No, score=-0.802 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id udlK8cy30N44 for ; Fri, 3 Jun 2016 19:49:46 +0000 (UTC) Received: from mail-io0-f169.google.com (mail-io0-f169.google.com [209.85.223.169]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 9E1745F247 for ; Fri, 3 Jun 2016 19:49:46 +0000 (UTC) Received: by mail-io0-f169.google.com with SMTP id o189so75878199ioe.2 for ; Fri, 03 Jun 2016 12:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=5yQ/u3W+M1NhENvBJs35FKM/kH4rHfTki6RXhkuzs7s=; b=l5RmGJBeRoTLfvGI18mGzKSqlWKIbOSbeiKb5FkBy2y1UzsJV1lY48Hti9P0U6Ftwt XQqqcVYPmYhCGAf1ebMsYLDYKtRBoilNscgfvTcu//UWrFgnVRFUyp8PZYtAWztVty8Z GvAe8OUJCFKjtit/3T+t76RdU1+GNTdtBbMxXb/I0EjTEGoEvfj1Olek7Ut/KXvCCQEi 13lJvAKZ76uvqNWJEw26PRgA4PXcPWCVuCGLizgIvvPgHXjObRaw/BPQ/l39HyvX6x+W +SD3M0HZPIPGTKJFvSPO4kxoJSZ2HfOrO8s5BBwMrMYU6DfSyPLO4qUo2E70kvl+O+6e +CgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=5yQ/u3W+M1NhENvBJs35FKM/kH4rHfTki6RXhkuzs7s=; b=DVKnP1TvEJRz4QCG9nR4lFzOpETYHCatb6ZaYqCPkgvFAfqL6uC5d96d6G2TQJqQdT PBc92nEgI7Dx8tZCNvOK0D511czbbeNl89LWkr3ocZRomLMds9Thk5t103zR6JstpeXD Rtu7glt/gxJqxLUbWBKOuej+9uLJ1zqiVGlXLUlYZkYvQQp+iRng8nLeMpxTb567TEYU yp3M2dTjVpd0junOpS5O1ZSMncgoZwK6L4/2zbfeAvaqrdAvaBmruA8Dl3u9f2EE/ajD n2c/LLPvcZw7EkRwdeopl1hAUAf/A/KXeHC66oc+HHqEIUM+VSfOn8ITN6Gx9DJ6RWV3 94uQ== X-Gm-Message-State: ALyK8tKH86YpNHffQOuD9+pjVW+1o9sZce/fiO+vq9tDMTBufj/h8Ri4aSPmagNv9MmaiXHMgQgjpI2jr0fByQ== X-Received: by 10.36.73.22 with SMTP id z22mr1970174ita.88.1464983380143; Fri, 03 Jun 2016 12:49:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.77.195 with HTTP; Fri, 3 Jun 2016 12:49:39 -0700 (PDT) In-Reply-To: <1464978073.4082.1.camel@apache.org> References: <1464978073.4082.1.camel@apache.org> From: Benson Margulies Date: Fri, 3 Jun 2016 15:49:39 -0400 Message-ID: Subject: Re: Multipart Mixed To: HttpClient User Discussion Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable archived-at: Fri, 03 Jun 2016 19:49:50 -0000 Here's what I coded. It's not a patch, just code you're welcome to, but it's probably much like yours. private void setupMultipartRequest(final DocumentRequest request, final ObjectWriter finalWriter, HttpPost post) { MultipartEntityBuilder builder =3D MultipartEntityBuilder.create(); builder.setMimeSubtype("mixed"); builder.setMode(HttpMultipartMode.STRICT); FormBodyPartBuilder partBuilder =3D FormBodyPartBuilder.create("request= ", // Make sure we're not mislead by someone who puts a charset into the mime type. new AbstractContentBody(ContentType.parse(ContentType.APPLICATION_JSON.getMimeT= ype())) { @Override public String getFilename() { return null; } @Override public void writeTo(OutputStream out) throws IOException { finalWriter.writeValue(out, request); } @Override public String getTransferEncoding() { return MIME.ENC_BINARY; } @Override public long getContentLength() { return -1; } }); // Either one of 'name=3D' or 'Content-ID' would be enough. partBuilder.setField(MIME.CONTENT_DISPOSITION, "inline;name=3D\"request= \""); partBuilder.setField("Content-ID", "request"); builder.addPart(partBuilder.build()); partBuilder =3D FormBodyPartBuilder.create("content", new InputStreamBody(request.getContentBytes(), ContentType.parse(request.getContentType()))); partBuilder.setField(MIME.CONTENT_DISPOSITION, "inline;name=3D\"content= \""); partBuilder.setField("Content-ID", "content"); builder.addPart(partBuilder.build()); builder.setCharset(StandardCharsets.UTF_8); HttpEntity entity =3D builder.build(); post.setEntity(entity); } On Fri, Jun 3, 2016 at 2:21 PM, Oleg Kalnichevski wrote: > On Thu, 2016-06-02 at 12:52 +0200, Stefan Magnus Landr=C3=B8 wrote: >> Hi there, >> >> We're struggeling with some limitations in the current multipart >> implementation in 4.5 (latest). >> >> The MultipartEntityBuilder is actually building a MultipartFormEntity, >> whereas we actually want to be able to build a multipart/mixed entity wh= ich >> does have limitations with respect to filesize as defined in >> MultipartFormEntity. >> >> We're considering improving the MultipartEntityBuilder in such a way tha= t >> it can also produce MultipartMixedEntity (new type) >> >> Oleg, any comments? >> > > Stefan > > I am not sure I fully understand the issue but you are welcome to submit > a patch with changes you deem necessary. > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org