如何从Session
的{{1}}获取WebSocket String
和request
?另外,如果请求是WebSocket请求,如何确定请求是Filter
,Open
还是Message
请求?
假设:
Close
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
//Session session = request.getWebSocketSession(); ??
//String string = request.getWebSocketMessage().toString(); ??
}
将上述日志记录置于Logger.getLogger(Example.class.getName()).log(Level.INFO, "New request to {0}", (HttpServletRequest) request.getRequestURL().toString());
内会在新的websocket doFilter
请求时产生以下结果:
open
即使我的Javascript设置为:
New request to http://localhost:8080/example
查看API后,似乎有new WebSocket("ws://localhost:8090/example");
,但我看不到有关WsFilter
或Session