Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 72170 invoked from network); 27 Feb 2008 15:24:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Feb 2008 15:24:43 -0000 Received: (qmail 48177 invoked by uid 500); 27 Feb 2008 15:24:28 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 47905 invoked by uid 500); 27 Feb 2008 15:24:27 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 47894 invoked by uid 99); 27 Feb 2008 15:24:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2008 07:24:27 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [72.22.94.67] (HELO virtual.halosg.com) (72.22.94.67) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2008 15:23:51 +0000 Received: (qmail 28231 invoked from network); 27 Feb 2008 09:14:32 -0600 Received: from 72-19-171-138.static.mesanetworks.net (HELO ?192.168.3.177?) (72.19.171.138) by halosg.com with SMTP; 27 Feb 2008 09:14:32 -0600 Message-ID: <47C580AA.80303@hanik.com> Date: Wed, 27 Feb 2008 08:24:26 -0700 From: Filip Hanik - Dev Lists User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: how to send http response in several chunked package with Tomcat References: <007f01c8786c$705fb260$0300000a@animal> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org you don't need to do that, tomcat does it for you. all you need to do is while (havedata) { response.getOutputStream().println(some data) response.flushBuffer() } and tomcat takes care of the rest Filip Hanks Wang (hanwan) wrote: > Hi Johnny, > > I try below method implement the chunk in code: > > String tmp = "something very long"; > > String hlen = Integer.toHexString(tmp.length()); > hlen = hlen +"\r\n" + tmp.toString(); > String chunkend = Integer.toHexString(0)+"\r\n"; > response.getOutputStream().println(hlen); > response.getOutputStream().println(chunkend); > > I created two http chunk successfully by this way. The first chunk is > the data which wraps tmp, the second is the end chunk. > > But the question is, all these chunk and http header are in same frame > (get it from wireshark.). > > How can I put them in different frame? > Which means we need 3 frame for the case: the first frame will carry the > http header, the second will carry the first chunk data, the last frame > will carry the end chunk. > > Does it mean I need control the tcp/ip protocol? It's impossible, right? > > B.R > Han > > > > -----Original Message----- > From: Hanks Wang (hanwan) > Sent: Wednesday, February 27, 2008 3:40 PM > To: Tomcat Users List > Subject: RE: how to send http response in several chunked package with > Tomcat > > Hi Johnny, > > Thanks a lot. I read the http RFC and find something like this: > > The chunk-size field is a string of hex digits indicating the size of > the chunk. The chunked encoding is ended by any chunk whose size is > zero, followed by the trailer, which is terminated by an empty line. > > Do u have any tutorial of ChunkedOutputFilter? I can't find anything > from its API document.. > > Thanks > Han > > > -----Original Message----- > From: Johnny Kewl [mailto:john@kewlstuff.co.za] > Sent: Tuesday, February 26, 2008 7:41 PM > To: Tomcat Users List > Subject: Re: how to send http response in several chunked package with > Tomcat > > > ------------------------------------------------------------------------ > --- > HARBOR: http://coolharbor.100free.com/index.htm > The most powerful application server on earth. > The only real POJO Application Server. > Making the Java dream come true. > ------------------------------------------------------------------------ > --- > ----- Original Message ----- > From: "Hanks Wang (hanwan)" > To: "Tomcat Users List" > Sent: Tuesday, February 26, 2008 12:02 PM > Subject: how to send http response in several chunked package with > Tomcat > > > Hi all, > > Is there a way to make tomcat generate http response in chunked-encoding > style? > > suppose I have a file resp.log and I can parse it in byte[], how can I > send the byte array in several chunked package? > > -------- > Hanks I have just started looking at this, so no expert but I did notice > > ChunkedInputFilter,ChunkedOutputFilter.... > > I think your answer is in setting a filter.... in normal Http I notice > that > chunking happens automatically > if header size ommited, but with so much control of the socket I think > you > have to pump it thru > a filter and then there must be a way to say last chuck... and start > chuck... > Short of that one would have to set headers themselves and add trailing > 0's > and end sequences, > so I think those classes are specific to http11 > > .... a guess > > Any suggestion is welcome! > > Thanks > Han > > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org