Class WebSocketServerProtocolConfig
java.lang.Object
io.netty.handler.codec.http.websocketx.WebSocketServerProtocolConfig
public final class WebSocketServerProtocolConfig
extends java.lang.Object
WebSocket server configuration.
Security note: By default no validation of the Origin header is performed during the
handshake. Browsers do not apply the same-origin policy to WebSocket connections and send ambient credentials
(like cookies) with the handshake request, so applications that authenticate WebSocket connections using such
credentials are exposed to Cross-Site WebSocket Hijacking unless they validate the Origin header.
Such applications must configure WebSocketServerProtocolConfig.Builder.allowedOrigins(String...) (or perform an
equivalent check in a handler placed before WebSocketServerProtocolHandler).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final java.util.Set<java.lang.String> private final booleanprivate final WebSocketDecoderConfig(package private) static final long(package private) static final longprivate final booleanprivate final longprivate final booleanprivate final longprivate final WebSocketCloseStatusprivate final java.lang.Stringprivate final java.lang.String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateWebSocketServerProtocolConfig(java.lang.String websocketPath, java.lang.String subprotocols, boolean checkStartsWith, long handshakeTimeoutMillis, long forceCloseTimeoutMillis, boolean handleCloseFrames, WebSocketCloseStatus sendCloseFrame, boolean dropPongFrames, WebSocketDecoderConfig decoderConfig, java.util.Set<java.lang.String> allowedOrigins) -
Method Summary
Modifier and TypeMethodDescriptionjava.util.Set<java.lang.String> Returns the (lower-cased) origins that are allowed to open a WebSocket connection, or an empty set if theOriginheader is not validated.booleanbooleanlongbooleanlongjava.lang.Stringjava.lang.StringtoString()java.lang.StringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
DEFAULT_HANDSHAKE_TIMEOUT_MILLIS
static final long DEFAULT_HANDSHAKE_TIMEOUT_MILLIS- See Also:
-
DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS
static final long DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS- See Also:
-
websocketPath
private final java.lang.String websocketPath -
subprotocols
private final java.lang.String subprotocols -
checkStartsWith
private final boolean checkStartsWith -
handshakeTimeoutMillis
private final long handshakeTimeoutMillis -
forceCloseTimeoutMillis
private final long forceCloseTimeoutMillis -
handleCloseFrames
private final boolean handleCloseFrames -
sendCloseFrame
-
dropPongFrames
private final boolean dropPongFrames -
decoderConfig
-
allowedOrigins
private final java.util.Set<java.lang.String> allowedOrigins
-
-
Constructor Details
-
WebSocketServerProtocolConfig
private WebSocketServerProtocolConfig(java.lang.String websocketPath, java.lang.String subprotocols, boolean checkStartsWith, long handshakeTimeoutMillis, long forceCloseTimeoutMillis, boolean handleCloseFrames, WebSocketCloseStatus sendCloseFrame, boolean dropPongFrames, WebSocketDecoderConfig decoderConfig, java.util.Set<java.lang.String> allowedOrigins)
-
-
Method Details
-
websocketPath
public java.lang.String websocketPath() -
subprotocols
public java.lang.String subprotocols() -
checkStartsWith
public boolean checkStartsWith() -
handshakeTimeoutMillis
public long handshakeTimeoutMillis() -
forceCloseTimeoutMillis
public long forceCloseTimeoutMillis() -
handleCloseFrames
public boolean handleCloseFrames() -
sendCloseFrame
-
dropPongFrames
public boolean dropPongFrames() -
decoderConfig
-
allowedOrigins
public java.util.Set<java.lang.String> allowedOrigins()Returns the (lower-cased) origins that are allowed to open a WebSocket connection, or an empty set if theOriginheader is not validated. -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
toBuilder
-
newBuilder
-