You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chandrasekar Krishnan <kr...@research.rutgers.edu> on 2004/11/18 14:57:35 UTC

HTTP persistence with Tomcat 4.1.29

Dear Tomcat users,

What is the most reliable way to verify that persistent HTTP connections
are maintained between a Tomcat server and a Java based Http Client
(both HTTP 1.0 and 1.1 requests)? I've tried something on my own
unsuccessfully.

On the Tomcat server, I have turned on logging for the incoming header
"Connection" using AccessLogValve Pattern (using %{Connection}i) and
verified that the client is sending "Keep-Alive". Is there any way to log
the response header "Connection" to see whether the server is not sending
"Close" in the response? I can't find a way to log response headers in
Tomcat. I have used netstat, but I can't get clinching evidence with it. 

Is it true that the Tomcat servlet needs to call setContentLength for
dynamic content to support persistent connections, even for HTTP 1.1
requests or is HTTP 1.1 sophisticated enough that it doesn't need that
header to maintain HTTP persistence? There are concerns with setting that
header if it's not needed, since it can cause a connection to hang if set
to an incorrect value.

I am using Tomcat server 4.1.29 on Solaris 5.8, JDK 1.4.2. The Http
Clients I use are Apache Commons and Trove Http Client.

Thanks in advance for your clarifications.
Chandrasekar



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: HTTP persistence with Tomcat 4.1.29

Posted by Tim Funk <fu...@joedog.org>.
 > verified that the client is sending "Keep-Alive". Is there any way to log
 > the response header "Connection" to see whether the server is not sending
 > "Close" in the response? I can't find a way to log response headers in

Not really. (With the existing code base)

Chunked encoding is needed for keep-alive to be effective. If you don't use 
chunked encoding, then your servlet must set the content length. Otherwise - 
the client won't know how much data is being returned. WIth chunked encoding 
  - data can be sent immediately without knowing the content length. (Just 
the length of the current chunk)

-Tim

Chandrasekar Krishnan wrote:

> Dear Tomcat users,
> 
> What is the most reliable way to verify that persistent HTTP connections
> are maintained between a Tomcat server and a Java based Http Client
> (both HTTP 1.0 and 1.1 requests)? I've tried something on my own
> unsuccessfully.
> 
> On the Tomcat server, I have turned on logging for the incoming header
> "Connection" using AccessLogValve Pattern (using %{Connection}i) and
> verified that the client is sending "Keep-Alive". Is there any way to log
> the response header "Connection" to see whether the server is not sending
> "Close" in the response? I can't find a way to log response headers in
> Tomcat. I have used netstat, but I can't get clinching evidence with it. 
> 
> Is it true that the Tomcat servlet needs to call setContentLength for
> dynamic content to support persistent connections, even for HTTP 1.1
> requests or is HTTP 1.1 sophisticated enough that it doesn't need that
> header to maintain HTTP persistence? There are concerns with setting that
> header if it's not needed, since it can cause a connection to hang if set
> to an incorrect value.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org