Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 71444 invoked from network); 21 Apr 2009 15:09:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Apr 2009 15:09:50 -0000 Received: (qmail 34282 invoked by uid 500); 21 Apr 2009 15:09:49 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 34231 invoked by uid 500); 21 Apr 2009 15:09:49 -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 34221 invoked by uid 99); 21 Apr 2009 15:09:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 15:09:49 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 63.134.253.17 is neither permitted nor denied by domain of richard@symplectic.co.uk) Received: from [63.134.253.17] (HELO turret.symplectic.org) (63.134.253.17) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 15:09:41 +0000 Received: by turret.symplectic.org (Postfix, from userid 508) id 808B149C523; Tue, 21 Apr 2009 16:09:18 +0100 (BST) Received: from [192.168.1.120] (94-194-200-240.zone8.bethere.co.uk [94.194.200.240]) by turret.symplectic.org (Postfix) with ESMTP id 9587549C517 for ; Tue, 21 Apr 2009 16:09:16 +0100 (BST) Message-ID: <49EDE199.5060909@symplectic.co.uk> Date: Tue, 21 Apr 2009 16:09:13 +0100 From: Richard Jones User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: httpclient-users@hc.apache.org Subject: mime-boundary headers Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.5 (2005-11-28) on turret.symplectic.org X-Spam-Level: X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=ham version=3.0.5 Hi Folks, Apologies if this is a newbie question; I'm a long time user of httpclient for basic purposes, but am being stumped this week by a more difficult requirement, and wonder if anyone can help. I need to assemble a multi-part request, consisting of some normal http headers, an xml document in the first mime-part, and a binary document in the second mime-part. I need to augment the mime-parts with their own http headers, also; specifically a Content-Type declaration and a Content-Disposition header for each one (which I believe is allowed by the MIME standard, from what I can discern from the rfc). My current code looks like this: HttpClient client = new HttpClient(); PostMethod post = new PostMethod(target); // set the request headers post.setRequestHeader("Slug", slug); post.setRequestHeader("X-On-Behalf-Of", user); // construct the xml and binary file parts FilePart xmlPart = new FilePart("atom", new File(xml), "text/xml", null); FilePart binaryPart = new FilePart("binary", new File(binary)); // make the multipart request body Part[] parts = { xmlPart, binaryPart }; MultipartRequestEntity re = new MultipartRequestEntity(parts, post.getParams()); post.setRequestEntity(re); // execute the post client.executeMethod(post); As you can see, I've got the Content-Type header being set properly in the FilePart constructor, and this works fine. What I can't figure out how to do is add the Content-Disposition header to either of these parts. I've poked around the examples, tutorials and mailing lists but haven't been able to find any examples of this, but I have seen references in the source code to the content disposition in the Part object from which FilePart eventually extends. Any help or pointers to documentation gratefully appreciated. All the best, Richard -- Richard Jones Head Repository Systems Architect, Symplectic Limited e: richard@symplectic.co.uk t: 0845 026 4755 t: +44 (0)207 7334036 w: http://www.symplectic.co.uk/ --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org