Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A22C56719 for ; Sun, 31 Jul 2011 12:30:47 +0000 (UTC) Received: (qmail 60000 invoked by uid 500); 31 Jul 2011 12:30:47 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 59921 invoked by uid 500); 31 Jul 2011 12:30:45 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 59913 invoked by uid 99); 31 Jul 2011 12:30:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Jul 2011 12:30:45 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.72.192.234] (HELO fmmailgate03.web.de) (217.72.192.234) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Jul 2011 12:30:38 +0000 Received: from smtp01.web.de ( [172.20.0.243]) by fmmailgate03.web.de (Postfix) with ESMTP id 6C515196469B7 for ; Sun, 31 Jul 2011 14:30:17 +0200 (CEST) Received: from [83.77.100.178] (helo=[127.0.0.1]) by smtp01.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1QnV9t-0004XS-00 for dev@hc.apache.org; Sun, 31 Jul 2011 14:30:17 +0200 Message-ID: <4E354AD9.8010608@web.de> Date: Sun, 31 Jul 2011 14:30:17 +0200 From: Michel Onoff User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: dev@hc.apache.org Subject: Re: Are requests and responses self-contained? References: <4C7B73B9.2090603@web.de> <1283163013.2084.18.camel@ubuntu> <4C7B85E3.1000001@web.de> <1283167959.2672.4.camel@ubuntu> <4C7BAD8B.5050005@web.de> <4E32F779.8010102@web.de> <1311977547.15754.62.camel@ubuntu> In-Reply-To: <1311977547.15754.62.camel@ubuntu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 110731-0, 07/31/2011), Outbound message X-Antivirus-Status: Clean Sender: michel.onoff@web.de X-Sender: michel.onoff@web.de X-Provags-ID: V01U2FsdGVkX19bskW2Gd2XftAnDwzDuDvmohIjNF5+kUC+e/ka QDQ/Jc8wwqJvoz+8/PaRijGllJ6v9Zop/BfuuNeECw1GyPgw9f BDc5AXWE6tY58e8kHiLA== X-Virus-Checked: Checked by ClamAV on apache.org On 2011-07-30 00:12, Oleg Kalnichevski wrote: > On Fri, 2011-07-29 at 20:10 +0200, Michel Onoff wrote: >> Hello, >> >> consider the following code, which form some reason assumes that >> requests have enclosing entities >> >> // conn is a DefaultHttpServerConnection, for example >> req1 = (HttpEntityEnclosingRequest) conn.receiveRequestHeader(); >> conn.receiveRequestEntity(req1); >> >> req2 = (HttpEntityEnclosingRequest) conn.receiveRequestHeader(); >> conn.receiveRequestEntity(req2); >> >> Can I later say req1.getRequestLine() or req1.getEntity(), even if in >> the meantime I got req2 from the same connection? > > No, you can't. You cannot obtain the second request object from the > connection before the request entity of the first one has been fully > consumed. > >> In other words, are requests fully self-contained and totally >> independent from the connection once both the header and the entity (if >> existing) have been received? >> > > No, they are not, if content entities are being streamed (not buffered > in memory). > So if I need to keep requests and responses I have to copy them to buffered equivalents using BasicHttpEntityEnclosingRequest, BasicHttpResponse, ByteArrayEntity and friends, right? Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org