Package io.vertx.core.http
Interface ServerWebSocketHandshake
-
public interface ServerWebSocketHandshakeA server WebSocket handshake, allows to control acceptance or rejection of a WebSocket.- Author:
- Julien Viet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Future<ServerWebSocket>accept()Accept the WebSocket and terminate the WebSocket handshake.HostAndPortauthority()MultiMapheaders()Returns the HTTP headers.booleanisSsl()SocketAddresslocalAddress()Stringpath()List<Certificate>peerCertificates()Stringquery()default Future<Void>reject()Reject the WebSocket.Future<Void>reject(int status)Likereject()but with astatus.SocketAddressremoteAddress()Stringscheme()SSLSessionsslSession()Stringuri()
-
-
-
Method Detail
-
headers
MultiMap headers()
Returns the HTTP headers.- Returns:
- the headers
-
scheme
String scheme()
- Returns:
- the WebSocket handshake scheme
-
authority
HostAndPort authority()
- Returns:
- the WebSocket handshake authority
-
uri
String uri()
-
path
String path()
- Returns:
- the WebSocket handshake path.
-
query
String query()
- Returns:
- the WebSocket handshake query string.
-
accept
Future<ServerWebSocket> accept()
Accept the WebSocket and terminate the WebSocket handshake. This method should be called from the WebSocket handler to explicitly accept the WebSocket and terminate the WebSocket handshake.- Throws:
IllegalStateException- when the WebSocket handshake is already set
-
reject
default Future<Void> reject()
Reject the WebSocket.Calling this method from the WebSocket handler when it is first passed to you gives you the opportunity to reject the WebSocket, which will cause the WebSocket handshake to fail by returning a 502 response code.
You might use this method, if for example you only want to accept WebSockets with a particular path.
- Throws:
IllegalStateException- when the WebSocket handshake is already set
-
remoteAddress
SocketAddress remoteAddress()
- Returns:
- the remote address for this connection, possibly
null(e.g a server bound on a domain socket). IfuseProxyProtocolis set totrue, the address returned will be of the actual connecting client.
-
localAddress
SocketAddress localAddress()
- Returns:
- the local address for this connection, possibly
null(e.g a server bound on a domain socket) IfuseProxyProtocolis set totrue, the address returned will be of the proxy.
-
isSsl
boolean isSsl()
- Returns:
- true if this
HttpConnectionis encrypted via SSL/TLS.
-
sslSession
SSLSession sslSession()
- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
- See Also:
SSLSession
-
peerCertificates
List<Certificate> peerCertificates() throws SSLPeerUnverifiedException
- Returns:
- an ordered list of the peer certificates. Returns null if connection is not SSL.
- Throws:
SSLPeerUnverifiedException- SSL peer's identity has not been verified.- See Also:
(),sslSession()
-
-