我有一个用例,通过设置一些属性将请求 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/