doFilter websocket会话和消息

时间:2015-04-30 11:19:35

标签: java tomcat websocket servlet-filters tomcat8

如何从Session的{​​{1}}获取WebSocket Stringrequest?另外,如果请求是WebSocket请求,如何确定请求是FilterOpen还是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");,但我看不到有关WsFilterSession

的任何信息

0 个答案:

没有答案