784ab6ad0ab11f49a33650e9d4e407a823cb6287
[JavaForFun] /
1 package de.spring.stomp.interceptors;
2
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
5 import org.springframework.http.server.ServerHttpRequest;
6 import org.springframework.http.server.ServerHttpResponse;
7 import org.springframework.web.socket.WebSocketHandler;
8 import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;
9
10 public class CustomHttpHandshakeInterceptor extends HttpSessionHandshakeInterceptor {
11         private static final Logger LOGGER = LoggerFactory.getLogger(CustomHttpHandshakeInterceptor.class);
12
13
14         @Override
15         public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response,
16                         WebSocketHandler wsHandler, Exception ex) {
17                 super.afterHandshake(request, response, wsHandler, ex);
18                 
19                 LOGGER.info("Request URI:" + request.getURI());
20                 LOGGER.info("Request remote address:" + request.getRemoteAddress());
21                 LOGGER.info("Request local address:" + request.getLocalAddress());
22                 LOGGER.info("Request headers:" + request.getHeaders());
23                 
24                 LOGGER.info("Response headers:" + response.getHeaders());               
25         }
26 }