Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 99662 invoked from network); 13 Dec 2006 19:28:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Dec 2006 19:28:57 -0000 Received: (qmail 32160 invoked by uid 500); 13 Dec 2006 19:29:03 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 32145 invoked by uid 500); 13 Dec 2006 19:29:03 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 32134 invoked by uid 99); 13 Dec 2006 19:29:03 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Dec 2006 11:29:03 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [212.227.126.186] (HELO moutng.kundenserver.de) (212.227.126.186) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Dec 2006 11:28:52 -0800 Received: from [85.180.22.148] (helo=[85.180.22.148]) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis), id 0MKwh2-1GuZmH2ljS-00072M; Wed, 13 Dec 2006 20:28:30 +0100 Message-ID: <4580551D.4010805@dubioso.net> Date: Wed, 13 Dec 2006 20:31:41 +0100 From: Roland Weber User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061110 SeaMonkey/1.0.6 MIME-Version: 1.0 To: HttpClient User Discussion Subject: Re: multipart post parameters? References: <457F63DC.70006@syncadd.com> <598ad5b50612130643n1d18243ek4d647c989ac872a2@mail.gmail.com> <20061213191308.241810@gmx.net> In-Reply-To: <20061213191308.241810@gmx.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:4601b1d39ab4ddfc21c613822e406392 X-Virus-Checked: Checked by ClamAV on apache.org Hello Bastian, > FilePart fPart = new FilePart(file.getName(), file); > StringPart sPart = new StringPart("MESSAGE", "UPLOAD"); > Part[] parts = {sPart, fPart}; > > postMethod.setRequestEntity( > new MultipartRequestEntity(parts, postMethod.getParams())); > > The servlet use org.apache.commons.fileupload to parse the files. > The usual way to get a message is not working with StringPart anymore > > request.getParameter("MESSAGE"); > > I only found a solution like > > if(reqeust.getContenetType().equals( "multipart/form-data")) > // parse all form data from the upload and get the message That is correct. If you send multipart form data, you need to get the parameter values from the parsed multipart data. If the Servlet API would support multipart form data, the audience for commons-fileupload would be smaller, I guess :-) There is one trick which you can _only_ use if the HttpClient application is and will be the only client for your servlet. In that case, you can send the string parameter as a query string in the URL and use a FileRequestEntity instead of a multipart request entity. Then you don't need fileupload on the server, but the format is not compatible with browsers. > some logs without setting anything These look fine. > if I am add setContentChuck(true)it is a bit better These look fine, too. The only difference is that chunked encoding will buffer the data on the client side and send it out in bigger chunks. Hence you get fewer log messages. > maybe there is a better way to transfer a message to let the > server know an upload is comming? I am new in this stuff. What about encoding it in the URL? http://my.server.name/path/to/servlet/upload cheers, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org