How can a Netty server cancel receiving a response from a web server?

牧云@^-^@ 提交于 2020-01-13 06:42:48

问题


Does anyone know the best way for a netty server handler to cancel receiving data from a web server? I have a server handler which proxies HttpRequests to a web server. However, when the requesting client cancels the request, I would like to stop receiving data on my server channel from the web server without closing the connection between the server handler and the web server.

Does anyone know how I can go about doing this. Your response would be much appreciated.

Thank you!


回答1:


You could call channel.config().setAutoRead(false) this will tell netty to stop reading from the Channel. Once you want to start reading again just call channel.config().setAutoRead(false).



来源:https://stackoverflow.com/questions/40668791/how-can-a-netty-server-cancel-receiving-a-response-from-a-web-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!