Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 74805 invoked from network); 27 Jun 2008 18:14:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Jun 2008 18:14:43 -0000 Received: (qmail 90399 invoked by uid 500); 27 Jun 2008 18:14:43 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 90381 invoked by uid 500); 27 Jun 2008 18:14:43 -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 90370 invoked by uid 99); 27 Jun 2008 18:14:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jun 2008 11:14:43 -0700 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: local policy) Received: from [217.150.250.44] (HELO ok2consulting.nine.ch) (217.150.250.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jun 2008 18:13:52 +0000 Received: by ok2consulting.nine.ch (Postfix, from userid 1002) id A12E81984C8; Fri, 27 Jun 2008 20:14:10 +0200 (CEST) Received: from [192.168.1.100] (84-75-129-240.dclient.hispeed.ch [84.75.129.240]) by ok2consulting.nine.ch (Postfix) with ESMTP id AAA2F1984C6 for ; Fri, 27 Jun 2008 20:14:09 +0200 (CEST) Subject: Re: persisting Response with HttpCore - implementing cache From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: <48647A73.90301@chello.at> References: <4846230A.5000307@chello.at> <1212579860.11424.7.camel@ubuntu> <48647A73.90301@chello.at> Content-Type: text/plain Date: Fri, 27 Jun 2008 20:14:09 +0200 Message-Id: <1214590449.6039.4.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on ok2consulting.nine.ch X-Spam-Level: X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=ham version=3.0.3 On Fri, 2008-06-27 at 07:28 +0200, pluenl wrote: > Oleg, > > thank you for your help. > Sorry that I didn't answer yet, but my time was short so that I could > have a look at all only yesterday. > > Am I right that HttpWriter/HttpParser only process the headers and the > message body writing/parsing is done via Entity(De)Serializer? > Yes, you are. > I adopted the Buffer-Mockups to use FileOutputStream but I do not use > the AbstractHttpClientConnection. > > I think the code I've implemented by now does what I need, but can you > please just have a look if there is a potentially problem in my code > e.g. use of internal API that may change? > Looks all right to me Oleg > Thanks in advance > Martin > > Here's the code extract (writing and reading response only): > > String filename = "c:/temp/response.txt"; > > EntitySerializer serializer = new EntitySerializer(new > StrictContentLengthStrategy()); > FileOutputStream fos = new FileOutputStream(filename); > SessionOutputBufferMockup sobm = new > SessionOutputBufferMockup(fos); > HttpResponseWriter writer = new HttpResponseWriter(sobm, > BasicLineFormatter.DEFAULT, new BasicHttpParams()); > writer.write(response); > serializer.serialize(sobm, response, response.getEntity()); > fos.close(); > > EntityDeserializer entityDeserializer = new > EntityDeserializer(new LaxContentLengthStrategy()); > FileInputStream fis = new FileInputStream(filename); > SessionInputBufferMockup sibm = new > SessionInputBufferMockup(fis, 1024); > HttpResponseParser responseParser = new HttpResponseParser( > sibm, > BasicLineParser.DEFAULT, > new DefaultHttpResponseFactory(), > new BasicHttpParams()); > > response = (HttpResponse) responseParser.parse(); > > response.setEntity(entityDeserializer.deserialize(sibm,response)); > fis.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org