We need to keep the old constructor to not break the API.

This commit is contained in:
vibul 2012-04-27 10:43:34 +10:00
parent 6009a413b9
commit 40e9b96764
11 changed files with 171 additions and 0 deletions

View File

@ -42,6 +42,17 @@ public class WebSocket00FrameDecoder extends ReplayingDecoder<VoidEnum> {
this(DEFAULT_MAX_FRAME_SIZE);
}
/**
* Creates a new instance of {@code WebSocketFrameDecoder} with the specified {@code maxFrameSize}. If the client
* sends a frame size larger than {@code maxFrameSize}, the channel will be closed.
*
* @param maxFrameSize
* the maximum frame size to decode
*/
public WebSocket00FrameDecoder(int maxFrameSize) {
this.maxFrameSize = maxFrameSize;
}
/**
* Creates a new instance of {@code WebSocketFrameDecoder} with the specified {@code maxFrameSize}. If the client
* sends a frame size larger than {@code maxFrameSize}, the channel will be closed.

View File

@ -99,6 +99,19 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocket08FrameDe
FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT
}
/**
* Constructor with default values
*
* @param maskedPayload
* Web socket servers must set this to true processed incoming masked payload. Client implementations
* must set this to false.
* @param allowExtensions
* Flag to allow reserved extension bits to be used or not
*/
public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) {
this(maskedPayload, allowExtensions, Long.MAX_VALUE);
}
/**
* Constructor
*

View File

@ -58,6 +58,19 @@ package io.netty.handler.codec.http.websocketx;
*/
public class WebSocket13FrameDecoder extends WebSocket08FrameDecoder {
/**
* Constructor with default values
*
* @param maskedPayload
* Web socket servers must set this to true processed incoming masked payload. Client implementations
* must set this to false.
* @param allowExtensions
* Flag to allow reserved extension bits to be used or not
*/
public WebSocket13FrameDecoder(boolean maskedPayload, boolean allowExtensions) {
this(maskedPayload, allowExtensions, Long.MAX_VALUE);
}
/**
* Constructor
*

View File

@ -41,6 +41,24 @@ public abstract class WebSocketClientHandshaker {
private final long maxFramePayloadLength;
/**
* Base constructor with default values
*
* @param webSocketUrl
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param version
* Version of web socket specification to use to connect to the server
* @param subprotocol
* Sub protocol request sent to the server.
* @param customHeaders
* Map of custom headers to add to the client request
*/
public WebSocketClientHandshaker(URI webSocketUrl, WebSocketVersion version, String subprotocol,
Map<String, String> customHeaders) {
this(webSocketUrl, version, subprotocol, customHeaders, Long.MAX_VALUE);
}
/**
* Base constructor
*

View File

@ -48,6 +48,24 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
private byte[] expectedChallengeResponseBytes;
/**
* Constructor with default values
*
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param version
* Version of web socket specification to use to connect to the server
* @param subprotocol
* Sub protocol request sent to the server.
* @param customHeaders
* Map of custom headers to add to the client request
*/
public WebSocketClientHandshaker00(URI webSocketURL, WebSocketVersion version, String subprotocol,
Map<String, String> customHeaders) {
this(webSocketURL, version, subprotocol, customHeaders, Long.MAX_VALUE);
}
/**
* Constructor specifying the destination web socket location and version to initiate
*

View File

@ -53,6 +53,26 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker {
private final boolean allowExtensions;
/**
* Constructor with default values
*
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param version
* Version of web socket specification to use to connect to the server
* @param subprotocol
* Sub protocol request sent to the server.
* @param allowExtensions
* Allow extensions to be used in the reserved bits of the web socket frame
* @param customHeaders
* Map of custom headers to add to the client request
*/
public WebSocketClientHandshaker08(URI webSocketURL, WebSocketVersion version, String subprotocol,
boolean allowExtensions, Map<String, String> customHeaders) {
this(webSocketURL, version, subprotocol, allowExtensions, customHeaders, Long.MAX_VALUE);
}
/**
* Constructor
*

View File

@ -53,6 +53,26 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
private final boolean allowExtensions;
/**
* Constructor with default values
*
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param version
* Version of web socket specification to use to connect to the server
* @param subprotocol
* Sub protocol request sent to the server.
* @param allowExtensions
* Allow extensions to be used in the reserved bits of the web socket frame
* @param customHeaders
* Map of custom headers to add to the client request
*/
public WebSocketClientHandshaker13(URI webSocketURL, WebSocketVersion version, String subprotocol,
boolean allowExtensions, Map<String, String> customHeaders) {
this(webSocketURL, version, subprotocol, allowExtensions, customHeaders, Long.MAX_VALUE);
}
/**
* Constructor
*

View File

@ -35,6 +35,21 @@ public abstract class WebSocketServerHandshaker {
private final long maxFramePayloadLength;
/**
* Constructor using default values
*
* @param version
* the protocol version
* @param webSocketUrl
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param subprotocols
* CSV of supported protocols. Null if sub protocols not supported.
*/
protected WebSocketServerHandshaker(WebSocketVersion version, String webSocketUrl, String subprotocols) {
this(version, webSocketUrl, subprotocols, Long.MAX_VALUE);
}
/**
* Constructor specifying the destination web socket location
*

View File

@ -50,6 +50,19 @@ public class WebSocketServerHandshaker00 extends WebSocketServerHandshaker {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker00.class);
/**
* Constructor with default values
*
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param subprotocols
* CSV of supported protocols
*/
public WebSocketServerHandshaker00(String webSocketURL, String subprotocols) {
this(webSocketURL, subprotocols, Long.MAX_VALUE);
}
/**
* Constructor specifying the destination web socket location
*

View File

@ -49,6 +49,21 @@ public class WebSocketServerHandshaker08 extends WebSocketServerHandshaker {
private final boolean allowExtensions;
/**
* Constructor using defaults
*
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param subprotocols
* CSV of supported protocols
* @param allowExtensions
* Allow extensions to be used in the reserved bits of the web socket frame
*/
public WebSocketServerHandshaker08(String webSocketURL, String subprotocols, boolean allowExtensions) {
this(webSocketURL, subprotocols, allowExtensions, Long.MAX_VALUE);
}
/**
* Constructor specifying the destination web socket location
*

View File

@ -50,6 +50,21 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker {
private final boolean allowExtensions;
/**
* Constructor using defaults
*
* @param webSocketURL
* URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param subprotocols
* CSV of supported protocols
* @param allowExtensions
* Allow extensions to be used in the reserved bits of the web socket frame
*/
public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, boolean allowExtensions) {
this(webSocketURL, subprotocols, allowExtensions, Long.MAX_VALUE);
}
/**
* Constructor specifying the destination web socket location
*