Class RequestInfoHandshakeInterceptor

java.lang.Object
net.solarnetwork.web.support.RequestInfoHandshakeInterceptor
All Implemented Interfaces:
org.springframework.web.socket.server.HandshakeInterceptor

public class RequestInfoHandshakeInterceptor extends Object implements org.springframework.web.socket.server.HandshakeInterceptor
HandshakeInterceptor that populates properties from the connection as message headers.
Since:
1.14
Version:
1.1
Author:
matt
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The attribute name for the HttpHeaders of the HTTP request.
    static final String
    The attribute name for the URI of the HTTP request.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Exception exception)
     
    boolean
    beforeHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Map<String,Object> attributes)
    Populate request information as session attributes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • REQUEST_URI_ATTR

      public static final String REQUEST_URI_ATTR
      The attribute name for the URI of the HTTP request.
      See Also:
    • REQUEST_HEADERS

      public static final String REQUEST_HEADERS
      The attribute name for the HttpHeaders of the HTTP request.
      See Also:
  • Constructor Details

    • RequestInfoHandshakeInterceptor

      public RequestInfoHandshakeInterceptor()
  • Method Details

    • beforeHandshake

      public boolean beforeHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Map<String,Object> attributes) throws Exception
      Populate request information as session attributes.

      The following attributes will be populated:

      requestUri
      The URI of the HTTP request.
      Specified by:
      beforeHandshake in interface org.springframework.web.socket.server.HandshakeInterceptor
      Throws:
      Exception
    • afterHandshake

      public void afterHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, org.springframework.web.socket.WebSocketHandler wsHandler, Exception exception)
      Specified by:
      afterHandshake in interface org.springframework.web.socket.server.HandshakeInterceptor