Reputation: 89
While configuring embedded jetty server in jetty 9.3.8, I am adding a connection listener to the server connector for keeping track of opening and closing of jetty HttpConnection.
The jetty thread [qtp..........] that is serving current request opens up a HttpConnection. After finishing the current request, how do i inform the jetty to close this HttpConnection. I do see closing of all opened connections in the callback from the listener from different clients after some time of serving the request.
I need to close the connection once i finish with the request, that is when i am done with a particular client.
Upvotes: 1
Views: 2353
Reputation: 49462
Closing of the connection is the responsibility of the HTTP spec and protocol.
Note: Be aware that connection close is HTTP version specific, following different semantics for HTTP/1.0 vs HTTP/1.1 vs HTTP/2
In general, the connection open/close handling is negotiated between the HTTP client and the HTTP server, and needs to follow those rules. Having the server arbitrarily close the connection based on some non HTTP spec behavior is ripe for abuse and will cause problems with intermediaries (such as proxies, routers, load balancers, caching servers, etc).
Upvotes: 1