Connection:Keep-Alive is indicate keep connection not to close. Keep-Alive header is controlling details such as how long you can actively close connection. In general these two header are coordinating to control re-use connection to avoid frequent handover heavy process.
There two important parameters can be configured for Keep-Alive,
- timeout, the most widely used to control the time to maintain idle connection
- max, control the number of requests through re-used connection. After server received max number requests it can safely close connection. And when client send out max number requests it can safely close connection in its side.
So there will be a uncommon combination if you set Connection:Keep-Alive and Keep-Alive:timeout=0. What’s behavior I leave the answer to reader. 🙂
直接从tomcat的code里拿出来改了下，GitHub地址， 基于jdk7编译的，所以确保你的tomcat使用兼容的jdk/jre。相对于tomcat原生的org.apache.catalina.filters.RequestDumperFilter，增强的功能在于可以打印出request body和response body内容。