当在浏览器中取消页面加载时,服务器中会发生什么? [英] What happens in the server when a page load is cancelled in the browser?

查看:31
本文介绍了当在浏览器中取消页面加载时,服务器中会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个虚构的网络应用程序中......

In a fictitious web application ...

  1. 用户点击了一个链接
  2. 服务器开始准备响应,但需要几秒钟
  3. 用户取消页面加载

请求会发生什么?服务器是否继续准备响应?响应是否到达浏览器?

What happens to the request? Does the server continue to prepare the response? Does the response arrive to the browser?

推荐答案

服务器将继续准备响应.当它尝试向客户端发送响应时,它会失败.这实际发生的时间可能取决于实际的应用服务器实现,响应是否被缓冲等.

The server will continue to prepare the response. When it tries to send the response to the client, it'll fail. When this actually happens will probably depend on the actual application server implementation, whether the response is buffered etc.

在 Java EE 应用服务器(Tomcat 和 WebLogic,可能还有其他服务器)中,您将收到以下异常:

In Java EE app servers (Tomcat and WebLogic, probably others as well), you'll get the following exception:

java.net.SocketException: Connection reset by peer: socket write error

这篇关于当在浏览器中取消页面加载时,服务器中会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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