J
Jason
When implementing a javax.servlet.http.HttpServlet, how do you override
the connector and close the HTTP connection? I've noticed the
following:
In Tomcat's server.xml, you can prevent any connection from being kept
open by setting maxKeepAliveRequests="1" in the Connector element.
This doesn't help me, though: in my server application, the application
knows when the user is done & when it's reasonable to close the
connection, but this isn't something you could configure in the
server.xml.
Also, I've noticed that you can manually do an
HttpServletResponse.setHeader("Connection", "close"), but this is
completely ignored by the connector. It leaves the TCP connection open
(hopefully the client will eventually close it), and in situations when
it does close the connection (such as an HTTP/1.0 req without
keep-alive) it appends a second "Connection: close".
There must be a way to do this, but I'm not seeing it.
the connector and close the HTTP connection? I've noticed the
following:
In Tomcat's server.xml, you can prevent any connection from being kept
open by setting maxKeepAliveRequests="1" in the Connector element.
This doesn't help me, though: in my server application, the application
knows when the user is done & when it's reasonable to close the
connection, but this isn't something you could configure in the
server.xml.
Also, I've noticed that you can manually do an
HttpServletResponse.setHeader("Connection", "close"), but this is
completely ignored by the connector. It leaves the TCP connection open
(hopefully the client will eventually close it), and in situations when
it does close the connection (such as an HTTP/1.0 req without
keep-alive) it appends a second "Connection: close".
There must be a way to do this, but I'm not seeing it.