Hi Filip,
Yes it works. Thanks a lot!
Christopher, in fact I'm writing a servlet to fool a management
software, So I need make sure the servlet response is as close to real
device as possible.
Thanks for everyone's help.
B.R
Han
-Original Message-
From: Filip Hanik - Dev Lists
Hi Filip,
Seems the method has a problem : tomcat puts the http header and part of
the body in the same chunk.
But I hope to generate the response in below format:
Suppose I need use String tmp as the response, tmp = part1 + part2 +
part3+part4;
we use 4 tcp frame totally for the http response:
//first flush headers
response.flushBuffer()
//then flush body
while (havedata) {
response.getOutputStream().println(some data)
response.flushBuffer()
}
you need to put your thinker hat on Hanks :)
Hanks Wang (hanwan) wrote:
Hi Filip,
Seems the method has a problem : tomcat puts the http
My God, I am actually not aware of that despite it's so obvious...
Thank u Filip!
B.R
Han
-Original Message-
From: Filip Hanik - Dev Lists [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 28, 2008 11:51 PM
To: Tomcat Users List
Subject: Re: how to send http response in several
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);
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:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Han,
Hanks Wang (hanwan) wrote:
| But the question is, all these chunk and http header are in same frame
| (get it from wireshark.).
Then you need to increase the number of characters being sent. If you
really are sending something long as a
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?
Any suggestion is welcome!
Thanks
Han
Sorry for sending again, add the version info here:
Tomcat version: 6.0
Http Connector: org.apache.coyote.http11.Http11NioProtocol
Thanks
Han
---
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.
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
11 matches
Mail list logo