[英]Does HttpServletResponse#sendError() ever throw an IOException?
The doc explains that the HttpServletResponse#sendError()
method throws an IOException
if an input or output exception occurs ( DRY ;). 该文档解释说, 如果发生输入或输出异常 ( DRY ;),则
HttpServletResponse#sendError()
方法将引发IOException
。
I couldn't find any scenario that makes this method throw that exception, is there any? 我找不到使该方法抛出该异常的任何情况,有吗?
HTTP is sent over TCP so you can safely assume that somewhere in the underlying HttpServletRequest
and HttpServletResponse
there is a SocketInputStream
and a SocketOutputStream
. HTTP是通过TCP发送的,因此您可以放心地假设在基础
HttpServletRequest
和HttpServletResponse
中的某个位置有SocketInputStream
和SocketOutputStream
。
If a user closes their browser or the network goes down client-side or server-side, then the server won't be able to receive requests or send responses. 如果用户关闭浏览器或网络在客户端或服务器端断开,则服务器将无法接收请求或发送响应。 If the disconnection happens while the server was in the process of
sendError()
, then an IOException will occur while writing to the SocketOutputStream
. 如果断开连接是在服务器处于
sendError()
过程中发生的,则在写入SocketOutputStream
将发生IOException。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.