Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D54110774 for ; Thu, 26 Feb 2015 08:06:01 +0000 (UTC) Received: (qmail 6355 invoked by uid 500); 26 Feb 2015 08:06:01 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 6307 invoked by uid 500); 26 Feb 2015 08:06:01 -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 6295 invoked by uid 99); 26 Feb 2015 08:06:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Feb 2015 08:06:00 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of brett.ryan@gmail.com designates 209.85.220.43 as permitted sender) Received: from [209.85.220.43] (HELO mail-pa0-f43.google.com) (209.85.220.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Feb 2015 08:05:34 +0000 Received: by pabkx10 with SMTP id kx10so12161657pab.0 for ; Thu, 26 Feb 2015 00:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:mime-version:subject :message-id:date:references:in-reply-to:to; bh=xvAa57NWVvbwhnewDKNdcMFdTLgRj6rugTdF+Y2eytA=; b=H0SneSq0nmhEBX+ShPn2w0RhIz//lGhyO1D1ib2ocI1Ma5j5w/3Tz6SaFaCDbKbCbv xr03kBhHm4qTRRJKSBwNpK2viK2IsoYSQZnykdhR+QB91L4xBnuuX5+F+MiNar7PU1Pm rEUZNjUU4iX8Z6qOxjBbjhi2O9ryo3QO8hvJh26M9gXHpJ0xT+bZcH05kQbKI2ZnK105 i9PuZX7uIK9u44KkA0/pCRaI0YP1wCjjm1jWb7I8J2AkgGysQN1iqynL+k+M09LxZZfz 4aDPcZckGwXfKNoLKgU2wZb1DszoVCDTx1viZYyRFhRN9i8QrQ1huEZfv6rhS8Q37Rk7 z/2g== X-Received: by 10.70.91.227 with SMTP id ch3mr12521150pdb.111.1424937886980; Thu, 26 Feb 2015 00:04:46 -0800 (PST) Received: from [10.145.171.66] (pa49-183-70-173.pa.vic.optusnet.com.au. [49.183.70.173]) by mx.google.com with ESMTPSA id pl8sm71677pdb.72.2015.02.26.00.04.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Feb 2015 00:04:45 -0800 (PST) From: Brett Ryan Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Re: 400 bad request POSTing to Tomcat 7.0.42 Message-Id: Date: Thu, 26 Feb 2015 19:04:39 +1100 References: <1424880217.10908.ezmlm@hc.apache.org> <54EDF7A9.5040108@gmail.com> <2799A29D-4FFB-484F-9525-6FEE978F5FA5@gmail.com> <54EE1D58.4020206@gmail.com> <54EECAA9.9050906@gmail.com> In-Reply-To: <54EECAA9.9050906@gmail.com> To: HttpClient User Discussion X-Mailer: iPhone Mail (12B466) X-Virus-Checked: Checked by ClamAV on apache.org > Since I produce the xml in memory, that's the way Marshal.marshal method w= orks, I could use the ByteArrayEntity using the byte[] from the ByteArrayOut= putStream supplied to marshal. Could you not do something like=20 PipedOutputStream out =3D new PipedOutputStream(); InputStream instr =3D new PipedInputStream(out); marshaller.marshal(object, out); HttpPost post =3D new HttpPost(); post.setEntity(new InputStreamEntity(instr)); I have t validated this as I'm just on my phone but thats where id start. Al= ways try to write to a stream wherever possible instead of building up in me= mory only to dump it out. > But docs tell me that ByteArrayEntity is not thread-safe, while I need to u= se HttpClient by conncurrent threads. You would be only creating the entity per request, so thread safety is not a= n issue. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org