web server apache tomcat11-25-Advanced IO and Tomcat

前言

整理这个官方翻译的系列,原因是网上大部分的 tomcat 版本比较旧,此版本为 v11 最新的版本。

开源项目

从零手写实现 tomcat minicat 别称【嗅虎】心有猛虎,轻嗅蔷薇。

系列文章

web server apache tomcat11-01-官方文档入门介绍

web server apache tomcat11-02-setup 启动

web server apache tomcat11-03-deploy 如何部署

web server apache tomcat11-04-manager 如何管理?

web server apache tomcat11-06-Host Manager App -- Text Interface

web server apache tomcat11-07-Realm Configuration

web server apache tomcat11-08-JNDI Resources

web server apache tomcat11-09-JNDI Datasource

web server apache tomcat11-10-Class Loader

web server apache tomcat11-11-Jasper 2 JSP Engine

web server apache tomcat11-12-SSL/TLS Configuration

web server apache tomcat11-13-SSI

web server apache tomcat11-14-CGI

web server apache tomcat11-15-proxy

web server apache tomcat11-16-mbean

web server apache tomcat11-17-default-servlet

web server apache tomcat11-18-clusting 集群

web server apache tomcat11-19-load balance 负载均衡

web server apache tomcat11-20-connectors 连接器

web server apache tomcat11-21-monitor and management 监控与管理

web server apache tomcat11-22-logging 日志

web server apache tomcat11-23-APR

web server apache tomcat11-24-Virtual Hosting and Tomcat

web server apache tomcat11-25-Advanced IO and Tomcat

web server apache tomcat11-26-maven jars

web server apache tomcat11-27-Security Considerations

web server apache tomcat11-28-Windows Service

web server apache tomcat11-29-Windows Authentication

web server apache tomcat11-30-The Tomcat JDBC Connection Pool

web server apache tomcat11-31-websocket

web server apache tomcat11-32-rewrite

web server apache tomcat11-33-CDI

web server apache tomcat11-34-Ahead of Time compilation support

介绍

重要提示:使用这些功能需要使用HTTP连接器。AJP连接器不支持它们。

异步写入

当使用HTTP连接器时,Tomcat支持使用sendfile发送大型静态文件。这些写操作在系统负载增加时会以最有效的方式异步执行。与使用阻塞写操作发送大型响应不同,可以将内容写入静态文件,并使用sendfile代码进行写入。缓存阀门可以利用这一点,将响应数据缓存到文件中,而不是将其存储在内存中。如果请求属性 org.apache.tomcat.sendfile.support 被设置为 Boolean.TRUE,则可以使用sendfile支持。

任何Servlet都可以通过设置适当的请求属性来指示Tomcat执行sendfile调用。还需要正确设置响应的内容长度。当使用sendfile时,最好确保请求或响应都没有被包装,因为响应主体将由连接器自身稍后发送,无法进行过滤。除了设置所需的3个请求属性之外,Servlet不应发送任何响应数据,但可以使用任何导致修改响应标头的方法(比如设置cookies)。

  • org.apache.tomcat.sendfile.filename:将作为String发送的文件的规范文件名
  • org.apache.tomcat.sendfile.start:作为Long的起始偏移量
  • org.apache.tomcat.sendfile.end:作为Long的结束偏移量

除了设置这些参数之外,还需要设置content-length头。Tomcat不会为您执行此操作,因为您可能已经将数据写入输出流。

请注意,使用sendfile将禁用Tomcat对响应的任何压缩操作。

相关推荐
进击的女IT2 分钟前
SpringBoot上传图片实现本地存储以及实现直接上传阿里云OSS
java·spring boot·后端
Miqiuha10 分钟前
lock_guard和unique_lock学习总结
java·数据库·学习
一 乐1 小时前
学籍管理平台|在线学籍管理平台系统|基于Springboot+VUE的在线学籍管理平台系统设计与实现(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·学习
数云界2 小时前
如何在 DAX 中计算多个周期的移动平均线
java·服务器·前端
阑梦清川2 小时前
Java继承、final/protected说明、super/this辨析
java·开发语言
快乐就好ya3 小时前
Java多线程
java·开发语言
IT学长编程3 小时前
计算机毕业设计 二手图书交易系统的设计与实现 Java实战项目 附源码+文档+视频讲解
java·spring boot·毕业设计·课程设计·毕业论文·计算机毕业设计选题·二手图书交易系统
CS_GaoMing4 小时前
Centos7 JDK 多版本管理与 Maven 构建问题和注意!
java·开发语言·maven·centos7·java多版本
艾伦~耶格尔4 小时前
Spring Boot 三层架构开发模式入门
java·spring boot·后端·架构·三层架构
man20174 小时前
基于spring boot的篮球论坛系统
java·spring boot·后端