如果HTTP客戶端關閉連線Servlet怎麼得到通知?
我指的是 *資料傳輸過程中* HTTP連線被客戶端關閉。下面是我以前在tomcat-user@jak
arta.apache.org上的問題原文:
I notice that the following jsp is still running when the client terminates
his web browser:
<%
for(int i=0;i<100;i++){
try{
Thread.currentThread().sleep(2000);
System.out.println((i+1)+": Hello");
for(int j=0;j<1000;j++)
out.println("hello");
}
catch(Exception e){
System.out.println("Exception");
e.printStackTrace();
}
}
%>
So althougth the jsp/servlet can no more write any data to the
browser(which is terminated by the client),the jsp/servlet can still write
the the jsp output stream "out" without any exception thrown by the
"println" method,and the jsp/servlet is blind to the fact that it can no
more really write any thing to the client(the client can no more receive
the data),it keeps running util it finishes the "for" cycles,just as
nothing happens.
But I want to be notified when the HTTP connection is close by the web
client.How can I do that?
望各位大牛解答,感激不盡。
arta.apache.org上的問題原文:
I notice that the following jsp is still running when the client terminates
his web browser:
<%
for(int i=0;i<100;i++){
try{
Thread.currentThread().sleep(2000);
System.out.println((i+1)+": Hello");
for(int j=0;j<1000;j++)
out.println("hello");
}
catch(Exception e){
System.out.println("Exception");
e.printStackTrace();
}
}
%>
So althougth the jsp/servlet can no more write any data to the
browser(which is terminated by the client),the jsp/servlet can still write
the the jsp output stream "out" without any exception thrown by the
"println" method,and the jsp/servlet is blind to the fact that it can no
more really write any thing to the client(the client can no more receive
the data),it keeps running util it finishes the "for" cycles,just as
nothing happens.
But I want to be notified when the HTTP connection is close by the web
client.How can I do that?
望各位大牛解答,感激不盡。
相關文章
- nio 當客戶端主動關閉連線,伺服器端怎麼才能知道客戶端伺服器
- 客戶端怎麼連線到伺服器?客戶端伺服器
- HTTP客戶端連線,選擇HttpClient還是OkHttp?HTTP客戶端client
- impala客戶端連線客戶端
- Redis客戶端連線Redis客戶端
- MongoDB系列一:MongoDB安裝、啟動關閉服務、客戶端連線MongoDB客戶端
- 客戶端連線資料時會報“ORA-12537:TNS連線已關閉”客戶端
- mysql、redis 客戶端連線池MySqlRedis客戶端
- vncserver建立與客戶端連線VNCServer客戶端
- Redis客戶端連線數DevOpsRedis客戶端dev
- 從客戶端連線ASM例項客戶端ASM
- WCF 關閉預設除錯客戶端除錯客戶端
- ftp客戶端,ftp客戶端軟體具體怎麼使用?FTP客戶端
- Java 客戶端 Jedis和JedisPool 連線池Java客戶端
- Oracle客戶端連線伺服器教程Oracle客戶端伺服器
- 客戶端連線資料庫的方法客戶端資料庫
- 客戶端連線故障檢查流程手段客戶端
- win10如何取消遠端桌面連線賬戶密碼登入_win10怎麼關閉遠端桌面賬戶密碼Win10密碼
- 4.2.14.1 關於啟用客戶端快速連線故障轉移客戶端
- 客戶端連線EBS 11i VIS報ORA-12537: TNS: 連線已關閉 錯誤的解決客戶端
- Oracle 19c中連線RMAN客戶端的連線方法Oracle客戶端
- win10關閉通知的聲音方法_怎麼關閉win10通知聲音Win10
- win10 通知圖示怎麼關閉_win10如何關閉通知提醒圖示Win10
- win10右邊通知怎麼關閉 win10右下角通知如何關閉Win10
- 使用 WebSocket 客戶端連線 MQTT 伺服器Web客戶端MQQT伺服器
- 配置ORACLE 客戶端連線到資料庫Oracle客戶端資料庫
- MySQL client客戶端的四種連線方式MySqlclient客戶端
- linux之客戶端連線數統計Linux客戶端
- 怎麼使用遠端桌面連線 win10怎麼遠端連線Win10
- netty系列之:搭建客戶端使用http1.1的方式連線http2伺服器Netty客戶端HTTP伺服器
- win10怎麼禁用所有通知_要怎麼關閉Win10通知訊息Win10
- win10 怎麼去掉通知聲音_win10通知聲音怎麼關閉Win10
- 怎麼刪除w10通知提醒_win10的通知怎麼全部關閉Win10
- 構造CAS客戶端的登入Servlet客戶端Servlet
- 求救:jdbc與mysql透過Servlet操作後連線關閉不了JDBCMySqlServlet
- 關於客戶端 APP 的專項測試怎麼做客戶端APP
- PL/SQL developer 遠端連線資料庫 客戶端配置SQLDeveloper資料庫客戶端
- win10關閉工作列通知方法_怎麼關閉win10訊息通知圖示Win10