如何强制Tomcat服务器在http响应中发送Keep-alive标头 [英] How to force Tomcat server to send the Keep-alive header in http response

查看:166
本文介绍了如何强制Tomcat服务器在http响应中发送Keep-alive标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个运行在tomcat 7服务器上的应用程序,我们希望发送回客户端的http响应中包含keep-alive标头.有没有办法更改某些配置(例如server.xml)以实现此目的?非常感谢!

We have an application running on a tomcat 7 server, and we want the http responses that send back to the client has the keep-alive header in it. Is there a way to change some configuration, like the server.xml to make this happen? Thanks a lot!

推荐答案

在HTTP/1.1中,除非另有说明(通过"Connection:close"标头),否则假定连接为保持活动状态.因此,通常不必显式设置keep-alive标头.

In HTTP/1.1, connections are assumed to be keep-alive, unless otherwise specified (by "Connection: close" header). Therefore it is usually unnecessary to explicitly set keep-alive header.

当然,您总是可以添加一个servlet过滤器,该过滤器设置所需的任何标头.

Of course, you can always add a servlet filter that sets whatever headers that you need.

这篇关于如何强制Tomcat服务器在http响应中发送Keep-alive标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆