Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 61822 invoked from network); 15 Feb 2007 20:27:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2007 20:27:08 -0000 Received: (qmail 78354 invoked by uid 500); 15 Feb 2007 20:27:05 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 78310 invoked by uid 500); 15 Feb 2007 20:27:05 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 78291 invoked by uid 99); 15 Feb 2007 20:27:04 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 12:27:04 -0800 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=HTML_MESSAGE,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [138.190.3.29] (HELO mrp.swissptt.ch) (138.190.3.29) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 12:26:53 -0800 Received: from sxmcmp02.corproot.net (SXMCMP02.corproot.net [138.190.70.98]) by mrp.swissptt.ch with ESMTP id l1FKQUe8016558 for ; Thu, 15 Feb 2007 21:26:30 +0100 (MET) Received: from sxsmtp01.corproot.net ([10.185.84.29]) by sxmcmp02.corproot.net with InterScan Messaging Security Suite; Thu, 15 Feb 2007 21:26:30 +0100 Received: from sxmbx51.corproot.net ([10.185.84.18]) by sxsmtp01.corproot.net with Microsoft SMTPSVC(6.0.3790.1830); Thu, 15 Feb 2007 21:26:30 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C7513F.931FAB33" Subject: IllegalStateException: Content must be set before entity is written Date: Thu, 15 Feb 2007 21:26:29 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: IllegalStateException: Content must be set before entity is written thread-index: AcdRP5LvbWDKf4PNSNWhJFDfuZJSoA== From: To: X-OriginalArrivalTime: 15 Feb 2007 20:26:30.0121 (UTC) FILETIME=[93681590:01C7513F] X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C7513F.931FAB33 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable hi there i'm traing to send a multipart reqest using the InputStreamRequestEntity in httpclient 3.0.1. this is the code: note: clientRequest is an incoming HttpServletRequest, and the stream used for the InputStreamRequestEntity's constructor is obtained by using the commons.FileUpload API. =20 ServletFileUpload upload =3D new ServletFileUpload(); FileItemIterator iter =3D upload.getItemIterator(clientRequest); while (iter.hasNext()) { FileItemStream item =3D iter.next(); String name =3D item.getFieldName(); if (item.isFormField()) { postMethod.addParameter(name, Streams.asString(item.openStream())); } else { postMethod.setRequestEntity(new InputStreamRequestEntity(item.openStream())); } } =20 upon executing the post method, the following exception is thrown: java.lang.IllegalStateException: Content must be set before entity is written at org.apache.commons.httpclient.methods.InputStreamRequestEntity.writeRequ est(InputStreamRequestEntity.java:176) at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequest Body(EntityEnclosingMethod.java:495) at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase .java:1973) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java :993) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe thodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho dDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 96) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 24) =20 i'm obviously doing something wrong ;-) .. could someone help me understand what? thanks in advance for any hint! cheers alessandro ------_=_NextPart_001_01C7513F.931FAB33--