Class HandshakeInfo
java.lang.Object
org.springframework.web.reactive.socket.HandshakeInfo
Simple container of information related to the handshake request that started
 the 
WebSocketSession session.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionHandshakeInfo(URI uri, HttpHeaders headers, MultiValueMap<String, HttpCookie> cookies, reactor.core.publisher.Mono<Principal> principal, String protocol, InetSocketAddress remoteAddress, Map<String, Object> attributes, String logPrefix) Constructor targeting server-side use with extra information such as the cookies, remote address, attributes, and a log prefix.HandshakeInfo(URI uri, HttpHeaders headers, reactor.core.publisher.Mono<Principal> principal, String protocol) Constructor with basic information about the handshake.HandshakeInfo(URI uri, HttpHeaders headers, reactor.core.publisher.Mono<Principal> principal, String protocol, InetSocketAddress remoteAddress, Map<String, Object> attributes, String logPrefix) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionAttributes extracted from the handshake request to add to the session.For a server session this returns the server request cookies from the handshake request.Return the HTTP headers from the handshake request, either server request headers for a server session or the client response headers for a client session.A log prefix used in the handshake to correlate log messages, if any.reactor.core.publisher.Mono<Principal>Return the principal associated with the handshake request, if any.For a server session this is the remote address where the handshake request came from.The sub-protocol negotiated at handshake time, ornullif none.getUri()Return the URL for the WebSocket endpoint.toString()
- 
Constructor Details- 
HandshakeInfopublic HandshakeInfo(URI uri, HttpHeaders headers, reactor.core.publisher.Mono<Principal> principal, @Nullable String protocol) Constructor with basic information about the handshake.- Parameters:
- uri- the endpoint URL
- headers- request headers for server or response headers or client
- principal- the principal for the session
- protocol- the negotiated sub-protocol (may be- null)
 
- 
HandshakeInfo@Deprecated public HandshakeInfo(URI uri, HttpHeaders headers, reactor.core.publisher.Mono<Principal> principal, @Nullable String protocol, @Nullable InetSocketAddress remoteAddress, Map<String, Object> attributes, @Nullable String logPrefix) Deprecated.as of 5.3.5 in favor ofHandshakeInfo(URI, HttpHeaders, MultiValueMap, Mono, String, InetSocketAddress, Map, String)Constructor targeting server-side use with extra information such as the remote address, attributes, and a log prefix.- Parameters:
- uri- the endpoint URL
- headers- server request headers
- principal- the principal for the session
- protocol- the negotiated sub-protocol (may be- null)
- remoteAddress- the remote address of the client
- attributes- initial attributes for the WebSocket session
- logPrefix- the log prefix for the handshake request.
- Since:
- 5.1
 
- 
HandshakeInfopublic HandshakeInfo(URI uri, HttpHeaders headers, MultiValueMap<String, HttpCookie> cookies, reactor.core.publisher.Mono<Principal> principal, @Nullable String protocol, @Nullable InetSocketAddress remoteAddress, Map<String, Object> attributes, @Nullable String logPrefix) Constructor targeting server-side use with extra information such as the cookies, remote address, attributes, and a log prefix.- Parameters:
- uri- the endpoint URL
- headers- server request headers
- cookies- server request cookies
- principal- the principal for the session
- protocol- the negotiated sub-protocol (may be- null)
- remoteAddress- the remote address of the client
- attributes- initial attributes for the WebSocket session
- logPrefix- the log prefix for the handshake request.
- Since:
- 5.3.5
 
 
- 
- 
Method Details- 
getUriReturn the URL for the WebSocket endpoint.
- 
getHeadersReturn the HTTP headers from the handshake request, either server request headers for a server session or the client response headers for a client session.
- 
getCookiesFor a server session this returns the server request cookies from the handshake request. For a client session, it is an empty map.- Since:
- 5.3.5
 
- 
getPrincipalReturn the principal associated with the handshake request, if any.
- 
getSubProtocolThe sub-protocol negotiated at handshake time, ornullif none.
- 
getRemoteAddressFor a server session this is the remote address where the handshake request came from. For a client session, it isnull.- Since:
- 5.1
 
- 
getAttributesAttributes extracted from the handshake request to add to the session.- Since:
- 5.1
 
- 
getLogPrefixA log prefix used in the handshake to correlate log messages, if any.- Returns:
- a log prefix, or nullif not specified
- Since:
- 5.1
 
- 
toString
 
- 
HandshakeInfo(URI, HttpHeaders, MultiValueMap, Mono, String, InetSocketAddress, Map, String)