java - request.getRequestDispatcher().forward 会创建新线程吗?

标签 java servlets

我有一个用例,通过设置一些属性将请求 URL 修剪到相同的上下文来分派(dispatch)请求。这是在同一个线程中还是在新线程中处理?

最佳答案

它将在同一个线程中处理。 Servlet specification

The Container Provider should ensure that the dispatch of the request to a target servlet occurs in the same thread of the same JVM as the original request.

这似乎是一个建议,但我所知道的大多数实现都是在同一个线程中完成的。

关于java - request.getRequestDispatcher().forward 会创建新线程吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21248871/

相关文章:

Java - Netbeans应用程序 - 如何使用Lookup传输数据?

java - JAXB键值问题

java - sql数据库中存储图像的方法

java - 图像无法正确显示

java - Neo4j - 从给定标签开始遍历新 API 中的节点

java - Arquillian 在第一个测试类之后无法注入(inject)依赖项

java - 警告 : No mapping found for HTTP request with URI[] in DispatcherServlet with name []

java - 连接 Tomcat 6 和 MySQL 5(+ Plandora 项目管理软件)

java - Tomcat 7 无法创建工作目录

java - 处理 Java Web 应用程序启动错误的正确方法