Websocket拦截器HandshakeInterceptor

https://www.jianshu.com/p/7c98820f0364

org.springframework.web.socket.server

Interface HandshakeInterceptor

所有已知实现类

HttpSessionHandshakeInterceptor


public interface HandshakeInterceptor
WebSocket握手请求的拦截器. 检查握手请求和响应, 对WebSocketHandler传递属性


  • boolean beforeHandShake(ServerHttpRequest request,ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception
    在握手之前执行该方法, 继续握手返回true, 中断握手返回false. 通过attributes参数设置WebSocketSession的属性
  • void afterHandshake(ServerHttpRequest request,ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception
    在握手之后执行该方法. 无论是否握手成功都指明了响应状态码和相应头.


作者:写java的逗比叫z1
链接:https://www.jianshu.com/p/7c98820f0364
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

转载于:https://www.cnblogs.com/handsome1013/p/9389127.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值