Servlet引擎在调用Servlet之前是否会读取整个请求? [英] Does servlet engine read the whole request before calling a servlet?
问题描述
Servlet引擎(例如Tomcat
或Jetty
)接收HTTP请求,并使用HttpServletRequest
对象调用servlet,该对象包含请求主体的InputStream
.
Servlet engine (e.g. Tomcat
or Jetty
) receives an HTTP request and calls a servlet with an HttpServletRequest
object, which contains an InputStream
of the request body.
现在,我想知道引擎是否已经从网络读取了整个请求,而InputStream
只是内存中的缓冲区,还是已经部分读取了 请求当servlet调用InputStream.read
时,它实际上 读取套接字.
Now I wonder if the engine has already read the whole request from the network and the InputStream
is just a buffer in memory or it has read the request partially and when the servlet calls the InputStream.read
it actually reads the socket.
推荐答案
至少在POST情况下,它必须这样做,因此它可以从请求正文中的名称/值对形成requestParameterMap.
It has to, at least in the case of POST, so it can form the requestParameterMap from the name-value pairs in the body of the request.
这篇关于Servlet引擎在调用Servlet之前是否会读取整个请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!