public class HandshakeInfo extends Object
WebSocketSession
session.WebSocketSession.getHandshakeInfo()
Constructor and Description |
---|
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.
as of 5.3.5 in favor of
HandshakeInfo(URI, HttpHeaders, MultiValueMap, Mono, String, InetSocketAddress, Map, String) |
HandshakeInfo(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.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getAttributes()
Attributes extracted from the handshake request to add to the session.
|
MultiValueMap<String,HttpCookie> |
getCookies()
For a server session this returns the server request cookies from the
handshake request.
|
HttpHeaders |
getHeaders()
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.
|
String |
getLogPrefix()
A log prefix used in the handshake to correlate log messages, if any.
|
reactor.core.publisher.Mono<Principal> |
getPrincipal()
Return the principal associated with the handshake request, if any.
|
InetSocketAddress |
getRemoteAddress()
For a server session this is the remote address where the handshake
request came from.
|
String |
getSubProtocol()
The sub-protocol negotiated at handshake time, or
null if none. |
URI |
getUri()
Return the URL for the WebSocket endpoint.
|
String |
toString() |
public HandshakeInfo(URI uri, HttpHeaders headers, reactor.core.publisher.Mono<Principal> principal, @Nullable String protocol)
uri
- the endpoint URLheaders
- request headers for server or response headers or clientprincipal
- the principal for the sessionprotocol
- the negotiated sub-protocol (may be null
)@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)
HandshakeInfo(URI, HttpHeaders, MultiValueMap, Mono, String, InetSocketAddress, Map, String)
uri
- the endpoint URLheaders
- server request headersprincipal
- the principal for the sessionprotocol
- the negotiated sub-protocol (may be null
)remoteAddress
- the remote address of the clientattributes
- initial attributes for the WebSocket sessionlogPrefix
- the log prefix for the handshake request.public 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)
uri
- the endpoint URLheaders
- server request headerscookies
- server request cookiesprincipal
- the principal for the sessionprotocol
- the negotiated sub-protocol (may be null
)remoteAddress
- the remote address of the clientattributes
- initial attributes for the WebSocket sessionlogPrefix
- the log prefix for the handshake request.public URI getUri()
public HttpHeaders getHeaders()
public MultiValueMap<String,HttpCookie> getCookies()
public reactor.core.publisher.Mono<Principal> getPrincipal()
@Nullable public String getSubProtocol()
null
if none.@Nullable public InetSocketAddress getRemoteAddress()
null
.public Map<String,Object> getAttributes()
@Nullable public String getLogPrefix()
null
if not specified