Class WebSocketServerProtocolConfig
- java.lang.Object
-
- io.netty.handler.codec.http.websocketx.WebSocketServerProtocolConfig
-
public final class WebSocketServerProtocolConfig extends java.lang.ObjectWebSocket server configuration.Security note: By default no validation of the
Originheader 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 theOriginheader. Such applications must configureWebSocketServerProtocolConfig.Builder.allowedOrigins(String...)(or perform an equivalent check in a handler placed beforeWebSocketServerProtocolHandler).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWebSocketServerProtocolConfig.Builder
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.String>allowedOriginsprivate booleancheckStartsWithprivate WebSocketDecoderConfigdecoderConfig(package private) static longDEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS(package private) static longDEFAULT_HANDSHAKE_TIMEOUT_MILLISprivate booleandropPongFramesprivate longforceCloseTimeoutMillisprivate booleanhandleCloseFramesprivate longhandshakeTimeoutMillisprivate WebSocketCloseStatussendCloseFrameprivate java.lang.Stringsubprotocolsprivate java.lang.StringwebsocketPath
-
Constructor Summary
Constructors Modifier Constructor Description privateWebSocketServerProtocolConfig(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.booleancheckStartsWith()WebSocketDecoderConfigdecoderConfig()booleandropPongFrames()longforceCloseTimeoutMillis()booleanhandleCloseFrames()longhandshakeTimeoutMillis()static WebSocketServerProtocolConfig.BuildernewBuilder()WebSocketCloseStatussendCloseFrame()java.lang.Stringsubprotocols()WebSocketServerProtocolConfig.BuildertoBuilder()java.lang.StringtoString()java.lang.StringwebsocketPath()
-
-
-
Field Detail
-
DEFAULT_HANDSHAKE_TIMEOUT_MILLIS
static final long DEFAULT_HANDSHAKE_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS
static final long DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
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
private final WebSocketCloseStatus sendCloseFrame
-
dropPongFrames
private final boolean dropPongFrames
-
decoderConfig
private final WebSocketDecoderConfig decoderConfig
-
allowedOrigins
private final java.util.Set<java.lang.String> allowedOrigins
-
-
Constructor Detail
-
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 Detail
-
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
public WebSocketCloseStatus sendCloseFrame()
-
dropPongFrames
public boolean dropPongFrames()
-
decoderConfig
public WebSocketDecoderConfig 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
public WebSocketServerProtocolConfig.Builder toBuilder()
-
newBuilder
public static WebSocketServerProtocolConfig.Builder newBuilder()
-
-