如果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?
望各位大牛解答,感激不盡。
相關文章
- 客戶端怎麼連線到伺服器?客戶端伺服器
- HTTP客戶端連線,選擇HttpClient還是OkHttp?HTTP客戶端client
- impala客戶端連線客戶端
- mysql、redis 客戶端連線池MySqlRedis客戶端
- Redis客戶端連線數DevOpsRedis客戶端dev
- 4.2.14.1 關於啟用客戶端快速連線故障轉移客戶端
- win10如何取消遠端桌面連線賬戶密碼登入_win10怎麼關閉遠端桌面賬戶密碼Win10密碼
- Java 客戶端 Jedis和JedisPool 連線池Java客戶端
- netty系列之:搭建客戶端使用http1.1的方式連線http2伺服器Netty客戶端HTTP伺服器
- win10 通知圖示怎麼關閉_win10如何關閉通知提醒圖示Win10
- win10右邊通知怎麼關閉 win10右下角通知如何關閉Win10
- ftp客戶端,ftp客戶端軟體具體怎麼使用?FTP客戶端
- HTTP 客戶端:RestClient、WebClient、RestTemplateHTTP客戶端RESTclientWeb
- HTTP客戶端框架之RetrofitHTTP客戶端框架
- Oracle 19c中連線RMAN客戶端的連線方法Oracle客戶端
- 使用 WebSocket 客戶端連線 MQTT 伺服器Web客戶端MQQT伺服器
- win10關閉通知的聲音方法_怎麼關閉win10通知聲音Win10
- win10 action center怎麼關閉通知_win10系統action center關閉通知如何操作Win10
- win10關閉工作列通知方法_怎麼關閉win10訊息通知圖示Win10
- 怎麼使用遠端桌面連線 win10怎麼遠端連線Win10
- 關於客戶端 APP 的專項測試怎麼做客戶端APP
- windows10系統怎麼關閉防火牆通知Windows防火牆
- win10系統通知聲音怎麼關閉 window10如何關閉系統通知聲音Win10
- 使用 Java 客戶端透過 HTTPS 連線到 EasysearchJava客戶端HTTP
- Presto學習筆記——Go客戶端連線PrestoREST筆記Go客戶端
- gRPC學習記錄(六)--客戶端連線池RPC客戶端
- 4.2.14 啟用客戶端快速連線故障轉移客戶端
- ESP作為單連線中的TCP客戶端TCP客戶端
- 怎麼刪除w10通知提醒_win10的通知怎麼全部關閉Win10
- win10怎麼禁用所有通知_要怎麼關閉Win10通知訊息Win10
- win10 怎麼去掉通知聲音_win10通知聲音怎麼關閉Win10
- php連結nsq客戶端PHP客戶端
- 高效能 HTTP 客戶端 undici 初探HTTP客戶端
- Java HTTP 客戶端的比較 - reflectoringJavaHTTP客戶端
- 關於go和資料庫連線,客戶端以及驅動的疑問?Go資料庫客戶端
- Win10系統怎麼關閉通知欄資訊Win10
- win10 關閉通知聲音方法 win10怎麼關閉聲音提示Win10
- 微服務整合Spring Cloud Alibaba Seata (二) 客戶端連線微服務SpringCloud客戶端
- 如何使用Redshift客戶端工具SQL Workbench來連線Redshift客戶端SQL