Servlet引擎在调用Servlet之前是否会读取整个请求? [英] Does servlet engine read the whole request before calling a servlet?

查看:122
本文介绍了Servlet引擎在调用Servlet之前是否会读取整个请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Servlet引擎(例如TomcatJetty)接收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屋!

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