public class WebSocketConnectOptions extends RequestOptions
HttpClient
connect a WebSocket
.Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ALLOW_ORIGIN_HEADER
The default WebSocket allow origin header =
true |
static ProxyOptions |
DEFAULT_PROXY_OPTIONS
The default value for proxy options =
null |
static List<String> |
DEFAULT_SUB_PROTOCOLS
The default WebSocket sub protocols =
null |
static WebsocketVersion |
DEFAULT_VERSION
The default WebSocket version =
WebsocketVersion.V13 |
DEFAULT_FOLLOW_REDIRECTS, DEFAULT_HOST, DEFAULT_HTTP_METHOD, DEFAULT_PORT, DEFAULT_SERVER, DEFAULT_SSL, DEFAULT_TIMEOUT, DEFAULT_URI
Constructor and Description |
---|
WebSocketConnectOptions() |
WebSocketConnectOptions(JsonObject json) |
WebSocketConnectOptions(WebSocketConnectOptions other) |
getFollowRedirects, getHeaders, getHost, getMethod, getPort, getServer, getTimeout, getURI, isSsl, removeHeader, removeHeader, setAbsoluteURI, setFollowRedirects, setMethod, setServer, setTimeout
public static final ProxyOptions DEFAULT_PROXY_OPTIONS
null
public static final WebsocketVersion DEFAULT_VERSION
WebsocketVersion.V13
public static final List<String> DEFAULT_SUB_PROTOCOLS
null
public static final boolean DEFAULT_ALLOW_ORIGIN_HEADER
true
public WebSocketConnectOptions()
public WebSocketConnectOptions(WebSocketConnectOptions other)
public WebSocketConnectOptions(JsonObject json)
public WebsocketVersion getVersion()
public WebSocketConnectOptions setVersion(WebsocketVersion version)
public List<String> getSubProtocols()
null
if there are nonepublic WebSocketConnectOptions setSubProtocols(List<String> subProtocols)
public WebSocketConnectOptions addSubProtocol(String subprotocol)
public ProxyOptions getProxyOptions()
getProxyOptions
in class RequestOptions
public RequestOptions setProxyOptions(ProxyOptions proxyOptions)
HttpClientOptions.setProxyOptions(ProxyOptions)
proxy options
for connections.setProxyOptions
in class RequestOptions
proxyOptions
- proxy options override objectpublic boolean getAllowOriginHeader()
origin
header to the WebSocket handshake requestpublic WebSocketConnectOptions setAllowOriginHeader(boolean allowOriginHeader)
origin
header to the WebSocket handshake request, enabled by default.
Set to false
when a server does not accept WebSocket with an origin header.
allowOriginHeader
- whether to add the origin
header to the WebSocket handshake requestpublic WebSocketConnectOptions setHost(String host)
RequestOptions
setHost
in class RequestOptions
public WebSocketConnectOptions setPort(Integer port)
RequestOptions
setPort
in class RequestOptions
public WebSocketConnectOptions setSsl(Boolean ssl)
RequestOptions
setSsl
in class RequestOptions
ssl
- true if enabledpublic WebSocketConnectOptions setURI(String uri)
RequestOptions
setURI
in class RequestOptions
uri
- the relative uripublic WebSocketConnectOptions addHeader(String key, String value)
RequestOptions
addHeader
in class RequestOptions
key
- the header keyvalue
- the header valuepublic WebSocketConnectOptions addHeader(CharSequence key, CharSequence value)
RequestOptions
addHeader
in class RequestOptions
key
- the header keyvalue
- the header valuepublic WebSocketConnectOptions addHeader(CharSequence key, Iterable<CharSequence> values)
addHeader
in class RequestOptions
public WebSocketConnectOptions putHeader(String key, String value)
RequestOptions
putHeader
in class RequestOptions
key
- the header keyvalue
- the header valuepublic WebSocketConnectOptions putHeader(CharSequence key, CharSequence value)
RequestOptions
putHeader
in class RequestOptions
key
- the header keyvalue
- the header valuepublic WebSocketConnectOptions putHeader(CharSequence key, Iterable<CharSequence> values)
putHeader
in class RequestOptions
public WebSocketConnectOptions setHeaders(MultiMap headers)
RequestOptions
setHeaders
in class RequestOptions
headers
- the headerspublic JsonObject toJson()
toJson
in class RequestOptions
Copyright © 2021 Eclipse. All rights reserved.