Top Description Methods
io.vertx.core.http

public Interface ServerWebSocketHandshake

Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.CacheReturn, .GenIgnore, .Nullable, .VertxGen, io.vertx.core.Future, .MultiMap, io.vertx.core.net.HostAndPort, .SocketAddress, javax.net.ssl.SSLPeerUnverifiedException, .SSLSession, java.security.cert.Certificate, java.util.List

A server WebSocket handshake, allows to control acceptance or rejection of a WebSocket.
Author
Julien Viet

Method Summary

Modifier and TypeMethod and Description
public Future<ServerWebSocket>
accept()

Accept the WebSocket and terminate the WebSocket handshake.

public @Nullable HostAndPort

Returns:

the WebSocket handshake authority
authority
()

public MultiMap

Returns:

the headers
headers
()

Returns the HTTP headers.

public boolean

Returns:

true if this io.vertx.core.http.HttpConnection is encrypted via SSL/TLS.
isSsl
()

public SocketAddress

Returns:

the local address for this connection, possibly null (e.g a server bound on a domain socket) If useProxyProtocol is set to true, the address returned will be of the proxy.
localAddress
()

public String

Returns:

the WebSocket handshake path.
path
()

public List<Certificate>

Returns:

an ordered list of the peer certificates. Returns null if connection is not SSL.
peerCertificates
()

public @Nullable String

Returns:

the WebSocket handshake query string.
query
()

public default Future<Void>
reject()

Reject the WebSocket.

public Future<Void>
reject(int status)

Like reject() but with a status.

public SocketAddress

Returns:

the remote address for this connection, possibly null (e.g a server bound on a domain socket). If useProxyProtocol is set to true, the address returned will be of the actual connecting client.
remoteAddress
()

public @Nullable String

Returns:

the WebSocket handshake scheme
scheme
()

public SSLSession

Returns:

SSLSession associated with the underlying socket. Returns null if connection is not SSL.
sslSession
()

public String
uri()

Method Detail

acceptback to summary
public 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.

Exceptions
IllegalStateException:
when the WebSocket handshake is already set
authorityback to summary
public @Nullable HostAndPort authority()
Returns:@Nullable HostAndPort

the WebSocket handshake authority

headersback to summary
public MultiMap headers()

Returns the HTTP headers.

Returns:MultiMap

the headers

isSslback to summary
public boolean isSsl()
Returns:boolean

true if this io.vertx.core.http.HttpConnection is encrypted via SSL/TLS.

localAddressback to summary
public SocketAddress localAddress()
Returns:SocketAddress

the local address for this connection, possibly null (e.g a server bound on a domain socket) If useProxyProtocol is set to true, the address returned will be of the proxy.

Annotations
@CacheReturn
pathback to summary
public String path()
Returns:String

the WebSocket handshake path.

peerCertificatesback to summary
public List<Certificate> peerCertificates() throws SSLPeerUnverifiedException
Returns:List<Certificate>

an ordered list of the peer certificates. Returns null if connection is not SSL.

Annotations
@GenIgnore
Exceptions
SSLPeerUnverifiedException:
SSL peer's identity has not been verified.
See Also
(), sslSession()
queryback to summary
public @Nullable String query()
Returns:@Nullable String

the WebSocket handshake query string.

rejectback to summary
public 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.

Exceptions
IllegalStateException:
when the WebSocket handshake is already set
rejectback to summary
public Future<Void> reject(int status)

Like reject() but with a status.

remoteAddressback to summary
public SocketAddress remoteAddress()
Returns:SocketAddress

the remote address for this connection, possibly null (e.g a server bound on a domain socket). If useProxyProtocol is set to true, the address returned will be of the actual connecting client.

Annotations
@CacheReturn
schemeback to summary
public @Nullable String scheme()
Returns:@Nullable String

the WebSocket handshake scheme

sslSessionback to summary
public SSLSession sslSession()
Returns:SSLSession

SSLSession associated with the underlying socket. Returns null if connection is not SSL.

Annotations
@GenIgnore:permitted-type
See Also
javax.net.ssl.SSLSession
uriback to summary
public String uri()