ing
This commit is contained in:
		
							parent
							
								
									f74352ab95
								
							
						
					
					
						commit
						1c35dd6024
					
				| @ -4,14 +4,14 @@ import io.netty.buffer.ByteBuf; | ||||
| import io.netty.buffer.Unpooled; | ||||
| 
 | ||||
| /** | ||||
|  * Web Socket frame containing binary data | ||||
|  * Socket frame containing binary data | ||||
|  */ | ||||
| public class BinaryWebSocketFrame extends WebSocketFrame { | ||||
| public class BinarySocketFrame extends SocketFrame { | ||||
| 
 | ||||
|   /** | ||||
|    * Creates a new empty binary frame. | ||||
|    */ | ||||
|   public BinaryWebSocketFrame() { | ||||
|   public BinarySocketFrame() { | ||||
|     super(Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -21,7 +21,7 @@ public class BinaryWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public BinaryWebSocketFrame(ByteBuf binaryData) { | ||||
|   public BinarySocketFrame(ByteBuf binaryData) { | ||||
|     super(binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -35,50 +35,50 @@ public class BinaryWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public BinaryWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   public BinarySocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(finalFragment, rsv, binaryData); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame copy() { | ||||
|     return (BinaryWebSocketFrame) super.copy(); | ||||
|   public BinarySocketFrame copy() { | ||||
|     return (BinarySocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame duplicate() { | ||||
|     return (BinaryWebSocketFrame) super.duplicate(); | ||||
|   public BinarySocketFrame duplicate() { | ||||
|     return (BinarySocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame retainedDuplicate() { | ||||
|     return (BinaryWebSocketFrame) super.retainedDuplicate(); | ||||
|   public BinarySocketFrame retainedDuplicate() { | ||||
|     return (BinarySocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame replace(ByteBuf content) { | ||||
|     return new BinaryWebSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   public BinarySocketFrame replace(ByteBuf content) { | ||||
|     return new BinarySocketFrame(isFinalFragment(), rsv(), content); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame retain() { | ||||
|   public BinarySocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame retain(int increment) { | ||||
|   public BinarySocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame touch() { | ||||
|   public BinarySocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public BinaryWebSocketFrame touch(Object hint) { | ||||
|   public BinarySocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -6,14 +6,14 @@ import io.netty.util.CharsetUtil; | ||||
| import io.netty.util.internal.StringUtil; | ||||
| 
 | ||||
| /** | ||||
|  * Web Socket Frame for closing the connection | ||||
|  * Socket Frame for closing the connection | ||||
|  */ | ||||
| public class CloseWebSocketFrame extends WebSocketFrame { | ||||
| public class CloseSocketFrame extends SocketFrame { | ||||
| 
 | ||||
|   /** | ||||
|    * Creates a new empty close frame. | ||||
|    */ | ||||
|   public CloseWebSocketFrame() { | ||||
|   public CloseSocketFrame() { | ||||
|     super(Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -26,7 +26,7 @@ public class CloseWebSocketFrame extends WebSocketFrame { | ||||
|    * @param reasonText | ||||
|    *            Reason text. Set to null if no text. | ||||
|    */ | ||||
|   public CloseWebSocketFrame(int statusCode, String reasonText) { | ||||
|   public CloseSocketFrame(int statusCode, String reasonText) { | ||||
|     this(true, 0, statusCode, reasonText); | ||||
|   } | ||||
| 
 | ||||
| @ -38,7 +38,7 @@ public class CloseWebSocketFrame extends WebSocketFrame { | ||||
|    * @param rsv | ||||
|    *            reserved bits used for protocol extensions | ||||
|    */ | ||||
|   public CloseWebSocketFrame(boolean finalFragment, int rsv) { | ||||
|   public CloseSocketFrame(boolean finalFragment, int rsv) { | ||||
|     this(finalFragment, rsv, Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -55,7 +55,7 @@ public class CloseWebSocketFrame extends WebSocketFrame { | ||||
|    * @param reasonText | ||||
|    *            Reason text. Set to null if no text. | ||||
|    */ | ||||
|   public CloseWebSocketFrame(boolean finalFragment, int rsv, int statusCode, String reasonText) { | ||||
|   public CloseSocketFrame(boolean finalFragment, int rsv, int statusCode, String reasonText) { | ||||
|     super(finalFragment, rsv, newBinaryData(statusCode, reasonText)); | ||||
|   } | ||||
| 
 | ||||
| @ -84,7 +84,7 @@ public class CloseWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. Must be 2 byte integer followed by optional UTF-8 encoded string. | ||||
|    */ | ||||
|   public CloseWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   public CloseSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(finalFragment, rsv, binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -123,45 +123,45 @@ public class CloseWebSocketFrame extends WebSocketFrame { | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame copy() { | ||||
|     return (CloseWebSocketFrame) super.copy(); | ||||
|   public CloseSocketFrame copy() { | ||||
|     return (CloseSocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame duplicate() { | ||||
|     return (CloseWebSocketFrame) super.duplicate(); | ||||
|   public CloseSocketFrame duplicate() { | ||||
|     return (CloseSocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame retainedDuplicate() { | ||||
|     return (CloseWebSocketFrame) super.retainedDuplicate(); | ||||
|   public CloseSocketFrame retainedDuplicate() { | ||||
|     return (CloseSocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame replace(ByteBuf content) { | ||||
|     return new CloseWebSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   public CloseSocketFrame replace(ByteBuf content) { | ||||
|     return new CloseSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame retain() { | ||||
|   public CloseSocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame retain(int increment) { | ||||
|   public CloseSocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame touch() { | ||||
|   public CloseSocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public CloseWebSocketFrame touch(Object hint) { | ||||
|   public CloseSocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -5,15 +5,15 @@ import io.netty.buffer.Unpooled; | ||||
| import io.netty.util.CharsetUtil; | ||||
| 
 | ||||
| /** | ||||
|  * Web Socket continuation frame containing continuation text or binary data. This is used for | ||||
|  * Socket continuation frame containing continuation text or binary data. This is used for | ||||
|  * fragmented messages where the contents of a messages is contained more than 1 frame. | ||||
|  */ | ||||
| public class ContinuationWebSocketFrame extends WebSocketFrame { | ||||
| public class ContinuationSocketFrame extends SocketFrame { | ||||
| 
 | ||||
|   /** | ||||
|    * Creates a new empty continuation frame. | ||||
|    */ | ||||
|   public ContinuationWebSocketFrame() { | ||||
|   public ContinuationSocketFrame() { | ||||
|     this(Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -23,7 +23,7 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { | ||||
|    * | ||||
|    * @param binaryData the content of the frame. | ||||
|    */ | ||||
|   public ContinuationWebSocketFrame(ByteBuf binaryData) { | ||||
|   public ContinuationSocketFrame(ByteBuf binaryData) { | ||||
|     super(binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -37,7 +37,7 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public ContinuationWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   public ContinuationSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(finalFragment, rsv, binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -51,7 +51,7 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { | ||||
|    * @param text | ||||
|    *            text content of the frame. | ||||
|    */ | ||||
|   public ContinuationWebSocketFrame(boolean finalFragment, int rsv, String text) { | ||||
|   public ContinuationSocketFrame(boolean finalFragment, int rsv, String text) { | ||||
|     this(finalFragment, rsv, fromText(text)); | ||||
|   } | ||||
| 
 | ||||
| @ -77,45 +77,45 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame copy() { | ||||
|     return (ContinuationWebSocketFrame) super.copy(); | ||||
|   public ContinuationSocketFrame copy() { | ||||
|     return (ContinuationSocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame duplicate() { | ||||
|     return (ContinuationWebSocketFrame) super.duplicate(); | ||||
|   public ContinuationSocketFrame duplicate() { | ||||
|     return (ContinuationSocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame retainedDuplicate() { | ||||
|     return (ContinuationWebSocketFrame) super.retainedDuplicate(); | ||||
|   public ContinuationSocketFrame retainedDuplicate() { | ||||
|     return (ContinuationSocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame replace(ByteBuf content) { | ||||
|     return new ContinuationWebSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   public ContinuationSocketFrame replace(ByteBuf content) { | ||||
|     return new ContinuationSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame retain() { | ||||
|   public ContinuationSocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame retain(int increment) { | ||||
|   public ContinuationSocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame touch() { | ||||
|   public ContinuationSocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public ContinuationWebSocketFrame touch(Object hint) { | ||||
|   public ContinuationSocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -4,14 +4,14 @@ import io.netty.buffer.ByteBuf; | ||||
| import io.netty.buffer.Unpooled; | ||||
| 
 | ||||
| /** | ||||
|  * Web Socket frame containing binary data | ||||
|  * Socket frame containing binary data | ||||
|  */ | ||||
| public class PingWebSocketFrame extends WebSocketFrame { | ||||
| public class PingSocketFrame extends SocketFrame { | ||||
| 
 | ||||
|   /** | ||||
|    * Creates a new empty ping frame. | ||||
|    */ | ||||
|   public PingWebSocketFrame() { | ||||
|   public PingSocketFrame() { | ||||
|     super(true, 0, Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -21,7 +21,7 @@ public class PingWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public PingWebSocketFrame(ByteBuf binaryData) { | ||||
|   public PingSocketFrame(ByteBuf binaryData) { | ||||
|     super(binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -35,50 +35,50 @@ public class PingWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public PingWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   public PingSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(finalFragment, rsv, binaryData); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame copy() { | ||||
|     return (PingWebSocketFrame) super.copy(); | ||||
|   public PingSocketFrame copy() { | ||||
|     return (PingSocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame duplicate() { | ||||
|     return (PingWebSocketFrame) super.duplicate(); | ||||
|   public PingSocketFrame duplicate() { | ||||
|     return (PingSocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame retainedDuplicate() { | ||||
|     return (PingWebSocketFrame) super.retainedDuplicate(); | ||||
|   public PingSocketFrame retainedDuplicate() { | ||||
|     return (PingSocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame replace(ByteBuf content) { | ||||
|     return new PingWebSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   public PingSocketFrame replace(ByteBuf content) { | ||||
|     return new PingSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame retain() { | ||||
|   public PingSocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame retain(int increment) { | ||||
|   public PingSocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame touch() { | ||||
|   public PingSocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PingWebSocketFrame touch(Object hint) { | ||||
|   public PingSocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -4,14 +4,14 @@ import io.netty.buffer.ByteBuf; | ||||
| import io.netty.buffer.Unpooled; | ||||
| 
 | ||||
| /** | ||||
|  * Web Socket frame containing binary data | ||||
|  * Socket frame containing binary data | ||||
|  */ | ||||
| public class PongWebSocketFrame extends WebSocketFrame { | ||||
| public class PongSocketFrame extends SocketFrame { | ||||
| 
 | ||||
|   /** | ||||
|    * Creates a new empty pong frame. | ||||
|    */ | ||||
|   public PongWebSocketFrame() { | ||||
|   public PongSocketFrame() { | ||||
|     super(Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -21,7 +21,7 @@ public class PongWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public PongWebSocketFrame(ByteBuf binaryData) { | ||||
|   public PongSocketFrame(ByteBuf binaryData) { | ||||
|     super(binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -35,50 +35,50 @@ public class PongWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public PongWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   public PongSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(finalFragment, rsv, binaryData); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame copy() { | ||||
|     return (PongWebSocketFrame) super.copy(); | ||||
|   public PongSocketFrame copy() { | ||||
|     return (PongSocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame duplicate() { | ||||
|     return (PongWebSocketFrame) super.duplicate(); | ||||
|   public PongSocketFrame duplicate() { | ||||
|     return (PongSocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame retainedDuplicate() { | ||||
|     return (PongWebSocketFrame) super.retainedDuplicate(); | ||||
|   public PongSocketFrame retainedDuplicate() { | ||||
|     return (PongSocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame replace(ByteBuf content) { | ||||
|     return new PongWebSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   public PongSocketFrame replace(ByteBuf content) { | ||||
|     return new PongSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame retain() { | ||||
|   public PongSocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame retain(int increment) { | ||||
|   public PongSocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame touch() { | ||||
|   public PongSocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public PongWebSocketFrame touch(Object hint) { | ||||
|   public PongSocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -15,16 +15,16 @@ import io.netty.util.internal.logging.InternalLogger; | ||||
| import io.netty.util.internal.logging.InternalLoggerFactory; | ||||
| 
 | ||||
| /** | ||||
|  * Decodes a web socket frame from wire protocol version 8 format. This code was forked from <a | ||||
|  * Decodes a socket frame from wire protocol version 8 format. This code was forked from <a | ||||
|  * href="https://github.com/joewalnes/webbit">webbit</a> and modified. | ||||
|  */ | ||||
| public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements WebSocketFrameDecoder { | ||||
| public class Socket13FrameDecoder extends ByteToMessageDecoder implements SocketFrameDecoder { | ||||
| 
 | ||||
|   enum State { | ||||
|     READING_FIRST, READING_SECOND, READING_SIZE, MASKING_KEY, PAYLOAD, CORRUPT | ||||
|   } | ||||
| 
 | ||||
|   private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket13FrameDecoder.class); | ||||
|   private static final InternalLogger logger = InternalLoggerFactory.getInstance(Socket13FrameDecoder.class); | ||||
| 
 | ||||
|   private static final byte OPCODE_CONT = 0x0; | ||||
|   private static final byte OPCODE_TEXT = 0x1; | ||||
| @ -52,7 +52,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|    * Constructor | ||||
|    * | ||||
|    * @param expectMaskedFrames | ||||
|    *            Web socket servers must set this to true processed incoming masked payload. Client implementations | ||||
|    *            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 | ||||
| @ -60,7 +60,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|    *            Maximum length of a frame's payload. Setting this to an appropriate value for you application | ||||
|    *            helps check for denial of services attacks. | ||||
|    */ | ||||
|   public WebSocket13FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength) { | ||||
|   public Socket13FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength) { | ||||
|     this(expectMaskedFrames, allowExtensions, maxFramePayloadLength, false); | ||||
|   } | ||||
| 
 | ||||
| @ -68,7 +68,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|    * Constructor | ||||
|    * | ||||
|    * @param expectMaskedFrames | ||||
|    *            Web socket servers must set this to true processed incoming masked payload. Client implementations | ||||
|    *            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 | ||||
| @ -79,7 +79,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|    *            When set to true, frames which are not masked properly according to the standard will still be | ||||
|    *            accepted. | ||||
|    */ | ||||
|   public WebSocket13FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength, | ||||
|   public Socket13FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength, | ||||
|       boolean allowMaskMismatch) { | ||||
|     this.expectMaskedFrames = expectMaskedFrames; | ||||
|     this.allowMaskMismatch = allowMaskMismatch; | ||||
| @ -104,7 +104,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|       frameOpcode = b & 0x0F; | ||||
| 
 | ||||
|       if (logger.isDebugEnabled()) { | ||||
|         logger.debug("Decoding WebSocket Frame opCode={}", frameOpcode); | ||||
|         logger.debug("Decoding Socket Frame opCode={}", frameOpcode); | ||||
|       } | ||||
| 
 | ||||
|       state = State.READING_SECOND; | ||||
| @ -209,7 +209,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|       } | ||||
| 
 | ||||
|       if (logger.isDebugEnabled()) { | ||||
|         logger.debug("Decoding WebSocket Frame length={}", framePayloadLength); | ||||
|         logger.debug("Decoding Socket Frame length={}", framePayloadLength); | ||||
|       } | ||||
| 
 | ||||
|       state = State.MASKING_KEY; | ||||
| @ -245,18 +245,18 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|         // Processing ping/pong/close frames because they cannot be | ||||
|         // fragmented | ||||
|         if (frameOpcode == OPCODE_PING) { | ||||
|           out.add(new PingWebSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           out.add(new PingSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           payloadBuffer = null; | ||||
|           return; | ||||
|         } | ||||
|         if (frameOpcode == OPCODE_PONG) { | ||||
|           out.add(new PongWebSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           out.add(new PongSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           payloadBuffer = null; | ||||
|           return; | ||||
|         } | ||||
|         if (frameOpcode == OPCODE_CLOSE) { | ||||
|           checkCloseFrameBody(ctx, payloadBuffer); | ||||
|           out.add(new CloseWebSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           out.add(new CloseSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           payloadBuffer = null; | ||||
|           return; | ||||
|         } | ||||
| @ -276,19 +276,19 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
| 
 | ||||
|         // Return the frame | ||||
|         if (frameOpcode == OPCODE_TEXT) { | ||||
|           out.add(new TextWebSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           out.add(new TextSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           payloadBuffer = null; | ||||
|           return; | ||||
|         } else if (frameOpcode == OPCODE_BINARY) { | ||||
|           out.add(new BinaryWebSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           out.add(new BinarySocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           payloadBuffer = null; | ||||
|           return; | ||||
|         } else if (frameOpcode == OPCODE_CONT) { | ||||
|           out.add(new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           out.add(new ContinuationSocketFrame(frameFinalFlag, frameRsv, payloadBuffer)); | ||||
|           payloadBuffer = null; | ||||
|           return; | ||||
|         } else { | ||||
|           throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); | ||||
|           throw new UnsupportedOperationException("Cannot decode socket frame with opcode: " + frameOpcode); | ||||
|         } | ||||
|       } finally { | ||||
|         if (payloadBuffer != null) { | ||||
| @ -340,7 +340,7 @@ public class WebSocket13FrameDecoder extends ByteToMessageDecoder implements Web | ||||
|   private void protocolViolation(ChannelHandlerContext ctx, CorruptedFrameException ex) { | ||||
|     state = State.CORRUPT; | ||||
|     if (ctx.channel().isActive()) { | ||||
|       Object closeMessage = new CloseWebSocketFrame(1002, null); | ||||
|       Object closeMessage = new CloseSocketFrame(1002, null); | ||||
|       ctx.writeAndFlush(closeMessage).addListener(ChannelFutureListener.CLOSE); | ||||
|     } | ||||
|     throw ex; | ||||
| @ -13,13 +13,13 @@ import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * <p> | ||||
|  * Encodes a web socket frame into wire protocol version 8 format. This code was forked from <a | ||||
|  * Encodes a socket frame into wire protocol version 8 format. This code was forked from <a | ||||
|  * href="https://github.com/joewalnes/webbit">webbit</a> and modified. | ||||
|  * </p> | ||||
|  */ | ||||
| public class WebSocket13FrameEncoder extends MessageToMessageEncoder<WebSocketFrame> implements WebSocketFrameEncoder { | ||||
| public class Socket13FrameEncoder extends MessageToMessageEncoder<SocketFrame> implements SocketFrameEncoder { | ||||
| 
 | ||||
|   private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket13FrameEncoder.class); | ||||
|   private static final InternalLogger logger = InternalLoggerFactory.getInstance(Socket13FrameEncoder.class); | ||||
| 
 | ||||
|   private static final byte OPCODE_CONT = 0x0; | ||||
|   private static final byte OPCODE_TEXT = 0x1; | ||||
| @ -42,30 +42,30 @@ public class WebSocket13FrameEncoder extends MessageToMessageEncoder<WebSocketFr | ||||
|    * Constructor | ||||
|    * | ||||
|    * @param maskPayload | ||||
|    *            Web socket clients must set this to true to mask payload. Server implementations must set this to | ||||
|    *            Socket clients must set this to true to mask payload. Server implementations must set this to | ||||
|    *            false. | ||||
|    */ | ||||
|   public WebSocket13FrameEncoder(boolean maskPayload) { | ||||
|   public Socket13FrameEncoder(boolean maskPayload) { | ||||
|     this.maskPayload = maskPayload; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception { | ||||
|   protected void encode(ChannelHandlerContext ctx, SocketFrame msg, List<Object> out) throws Exception { | ||||
|     final ByteBuf data = msg.content(); | ||||
|     byte[] mask; | ||||
| 
 | ||||
|     byte opcode; | ||||
|     if (msg instanceof TextWebSocketFrame) { | ||||
|     if (msg instanceof TextSocketFrame) { | ||||
|       opcode = OPCODE_TEXT; | ||||
|     } else if (msg instanceof PingWebSocketFrame) { | ||||
|     } else if (msg instanceof PingSocketFrame) { | ||||
|       opcode = OPCODE_PING; | ||||
|     } else if (msg instanceof PongWebSocketFrame) { | ||||
|     } else if (msg instanceof PongSocketFrame) { | ||||
|       opcode = OPCODE_PONG; | ||||
|     } else if (msg instanceof CloseWebSocketFrame) { | ||||
|     } else if (msg instanceof CloseSocketFrame) { | ||||
|       opcode = OPCODE_CLOSE; | ||||
|     } else if (msg instanceof BinaryWebSocketFrame) { | ||||
|     } else if (msg instanceof BinarySocketFrame) { | ||||
|       opcode = OPCODE_BINARY; | ||||
|     } else if (msg instanceof ContinuationWebSocketFrame) { | ||||
|     } else if (msg instanceof ContinuationSocketFrame) { | ||||
|       opcode = OPCODE_CONT; | ||||
|     } else { | ||||
|       throw new UnsupportedOperationException("Cannot encode frame of type: " + msg.getClass().getName()); | ||||
| @ -74,7 +74,7 @@ public class WebSocket13FrameEncoder extends MessageToMessageEncoder<WebSocketFr | ||||
|     int length = data.readableBytes(); | ||||
| 
 | ||||
|     if (logger.isDebugEnabled()) { | ||||
|       logger.debug("Encoding WebSocket Frame opCode=" + opcode + " length=" + length); | ||||
|       logger.debug("Encoding Socket Frame opCode=" + opcode + " length=" + length); | ||||
|     } | ||||
| 
 | ||||
|     int b0 = 0; | ||||
| @ -5,9 +5,9 @@ import io.netty.buffer.DefaultByteBufHolder; | ||||
| import io.netty.util.internal.StringUtil; | ||||
| 
 | ||||
| /** | ||||
|  * Base class for web socket frames | ||||
|  * Base class for socket frames | ||||
|  */ | ||||
| public abstract class WebSocketFrame extends DefaultByteBufHolder { | ||||
| public abstract class SocketFrame extends DefaultByteBufHolder { | ||||
| 
 | ||||
|   /** | ||||
|    * Flag to indicate if this frame is the final fragment in a message. The first fragment (frame) may also be the | ||||
| @ -20,11 +20,11 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder { | ||||
|    */ | ||||
|   private final int rsv; | ||||
| 
 | ||||
|   protected WebSocketFrame(ByteBuf binaryData) { | ||||
|   protected SocketFrame(ByteBuf binaryData) { | ||||
|     this(true, 0, binaryData); | ||||
|   } | ||||
| 
 | ||||
|   protected WebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   protected SocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(binaryData); | ||||
|     this.finalFragment = finalFragment; | ||||
|     this.rsv = rsv; | ||||
| @ -46,22 +46,22 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder { | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame copy() { | ||||
|     return (WebSocketFrame) super.copy(); | ||||
|   public SocketFrame copy() { | ||||
|     return (SocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame duplicate() { | ||||
|     return (WebSocketFrame) super.duplicate(); | ||||
|   public SocketFrame duplicate() { | ||||
|     return (SocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame retainedDuplicate() { | ||||
|     return (WebSocketFrame) super.retainedDuplicate(); | ||||
|   public SocketFrame retainedDuplicate() { | ||||
|     return (SocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public abstract WebSocketFrame replace(ByteBuf content); | ||||
|   public abstract SocketFrame replace(ByteBuf content); | ||||
| 
 | ||||
|   @Override | ||||
|   public String toString() { | ||||
| @ -69,25 +69,25 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder { | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame retain() { | ||||
|   public SocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame retain(int increment) { | ||||
|   public SocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame touch() { | ||||
|   public SocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public WebSocketFrame touch(Object hint) { | ||||
|   public SocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -4,9 +4,9 @@ import io.netty.channel.ChannelInboundHandler; | ||||
| import io.netty.channel.ChannelPipeline; | ||||
| 
 | ||||
| /** | ||||
|  * Marker interface which all WebSocketFrame decoders need to implement. | ||||
|  * Marker interface which all SocketFrame decoders need to implement. | ||||
|  * | ||||
|  * This makes it easier to access the added encoder later in the {@link ChannelPipeline}. | ||||
|  */ | ||||
| public interface WebSocketFrameDecoder extends ChannelInboundHandler { | ||||
| public interface SocketFrameDecoder extends ChannelInboundHandler { | ||||
| } | ||||
| @ -4,9 +4,9 @@ import io.netty.channel.ChannelOutboundHandler; | ||||
| import io.netty.channel.ChannelPipeline; | ||||
| 
 | ||||
| /** | ||||
|  * Marker interface which all WebSocketFrame encoders need to implement. | ||||
|  * Marker interface which all SocketFrame encoders need to implement. | ||||
|  * | ||||
|  * This makes it easier to access the added encoder later in the {@link ChannelPipeline}. | ||||
|  */ | ||||
| public interface WebSocketFrameEncoder extends ChannelOutboundHandler { | ||||
| public interface SocketFrameEncoder extends ChannelOutboundHandler { | ||||
| } | ||||
| @ -5,15 +5,15 @@ import io.netty.handler.codec.MessageToMessageDecoder; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| abstract class WebSocketProtocolHandler extends MessageToMessageDecoder<WebSocketFrame> { | ||||
| abstract class SocketProtocolHandler extends MessageToMessageDecoder<SocketFrame> { | ||||
|   @Override | ||||
|   protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception { | ||||
|     if (frame instanceof PingWebSocketFrame) { | ||||
|   protected void decode(ChannelHandlerContext ctx, SocketFrame frame, List<Object> out) throws Exception { | ||||
|     if (frame instanceof PingSocketFrame) { | ||||
|       frame.content().retain(); | ||||
|       ctx.channel().writeAndFlush(new PongWebSocketFrame(frame.content())); | ||||
|       ctx.channel().writeAndFlush(new PongSocketFrame(frame.content())); | ||||
|       return; | ||||
|     } | ||||
|     if (frame instanceof PongWebSocketFrame) { | ||||
|     if (frame instanceof PongSocketFrame) { | ||||
|       // Pong frames need to get ignored | ||||
|       return; | ||||
|     } | ||||
| @ -9,37 +9,37 @@ import io.netty.channel.ChannelPipeline; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * This handler does all the heavy lifting for you to run a websocket server. | ||||
|  * This handler does all the heavy lifting for you to run a socket server. | ||||
|  * | ||||
|  * It takes care of websocket handshaking as well as processing of control frames (Close, Ping, Pong). Text and Binary | ||||
|  * It takes care of socket handshaking as well as processing of control frames (Close, Ping, Pong). Text and Binary | ||||
|  * data frames are passed to the next handler in the pipeline (implemented by you) for processing. | ||||
|  * | ||||
|  * See <tt>io.netty.example.http.websocketx.html5.WebSocketServer</tt> for usage. | ||||
|  * See <tt>io.netty.example.http.websocketx.html5.SocketServer</tt> for usage. | ||||
|  * | ||||
|  * The implementation of this handler assumes that you just want to run  a websocket server and not process other types | ||||
|  * HTTP requests (like GET and POST). If you wish to support both HTTP requests and websockets in the one server, refer | ||||
|  * to the <tt>io.netty.example.http.websocketx.server.WebSocketServer</tt> example. | ||||
|  * The implementation of this handler assumes that you just want to run  a socket server and not process other types | ||||
|  * HTTP requests (like GET and POST). If you wish to support both HTTP requests and sockets in the one server, refer | ||||
|  * to the <tt>io.netty.example.http.websocketx.server.SocketServer</tt> example. | ||||
|  * | ||||
|  * To know once a handshake was done you can intercept the | ||||
|  * {@link ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object)} and check if the event was instance | ||||
|  * of {@link HandshakeComplete}, the event will contain extra information about the handshake such as the request and | ||||
|  * selected subprotocol. | ||||
|  */ | ||||
| public class WebSocketServerProtocolHandler extends WebSocketProtocolHandler { | ||||
| public class SocketServerProtocolHandler extends SocketProtocolHandler { | ||||
| 
 | ||||
|   private final boolean allowExtensions; | ||||
|   private final int maxFramePayloadLength; | ||||
|   private final boolean allowMaskMismatch; | ||||
| 
 | ||||
|   public WebSocketServerProtocolHandler(boolean allowExtensions) { | ||||
|   public SocketServerProtocolHandler(boolean allowExtensions) { | ||||
|     this(allowExtensions, 65536); | ||||
|   } | ||||
| 
 | ||||
|   public WebSocketServerProtocolHandler(boolean allowExtensions, int maxFrameSize) { | ||||
|   public SocketServerProtocolHandler(boolean allowExtensions, int maxFrameSize) { | ||||
|     this(allowExtensions, maxFrameSize, false); | ||||
|   } | ||||
| 
 | ||||
|   public WebSocketServerProtocolHandler(boolean allowExtensions, int maxFrameSize, boolean allowMaskMismatch) { | ||||
|   public SocketServerProtocolHandler(boolean allowExtensions, int maxFrameSize, boolean allowMaskMismatch) { | ||||
|     this.allowExtensions = allowExtensions; | ||||
|     maxFramePayloadLength = maxFrameSize; | ||||
|     this.allowMaskMismatch = allowMaskMismatch; | ||||
| @ -49,12 +49,12 @@ public class WebSocketServerProtocolHandler extends WebSocketProtocolHandler { | ||||
|   public void handlerAdded(ChannelHandlerContext ctx) { | ||||
|     ChannelPipeline cp = ctx.pipeline(); | ||||
| 
 | ||||
|     WebSocketFrameDecoder decoder = new WebSocket13FrameDecoder(true, allowExtensions, maxFramePayloadLength, | ||||
|     SocketFrameDecoder decoder = new Socket13FrameDecoder(true, allowExtensions, maxFramePayloadLength, | ||||
|         allowMaskMismatch); | ||||
|     WebSocketFrameEncoder encoder = new WebSocket13FrameEncoder(false); | ||||
|     SocketFrameEncoder encoder = new Socket13FrameEncoder(false); | ||||
| 
 | ||||
|     cp.addBefore(ctx.name(), WebSocketFrameDecoder.class.getName(), decoder); | ||||
|     cp.addBefore(ctx.name(), WebSocketFrameEncoder.class.getName(), encoder); | ||||
|     cp.addBefore(ctx.name(), SocketFrameDecoder.class.getName(), decoder); | ||||
|     cp.addBefore(ctx.name(), SocketFrameEncoder.class.getName(), encoder); | ||||
| 
 | ||||
|     if (cp.get(Utf8FrameValidator.class) == null) { | ||||
|       // Add the UFT8 checking before this one. | ||||
| @ -63,8 +63,8 @@ public class WebSocketServerProtocolHandler extends WebSocketProtocolHandler { | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception { | ||||
|     if (frame instanceof CloseWebSocketFrame) { | ||||
|   protected void decode(ChannelHandlerContext ctx, SocketFrame frame, List<Object> out) throws Exception { | ||||
|     if (frame instanceof CloseSocketFrame) { | ||||
|       ctx.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); | ||||
|       return; | ||||
|     } | ||||
| @ -5,14 +5,14 @@ import io.netty.buffer.Unpooled; | ||||
| import io.netty.util.CharsetUtil; | ||||
| 
 | ||||
| /** | ||||
|  * Web Socket text frame | ||||
|  * Socket text frame | ||||
|  */ | ||||
| public class TextWebSocketFrame extends WebSocketFrame { | ||||
| public class TextSocketFrame extends SocketFrame { | ||||
| 
 | ||||
|   /** | ||||
|    * Creates a new empty text frame. | ||||
|    */ | ||||
|   public TextWebSocketFrame() { | ||||
|   public TextSocketFrame() { | ||||
|     super(Unpooled.buffer(0)); | ||||
|   } | ||||
| 
 | ||||
| @ -22,7 +22,7 @@ public class TextWebSocketFrame extends WebSocketFrame { | ||||
|    * @param text | ||||
|    *            String to put in the frame | ||||
|    */ | ||||
|   public TextWebSocketFrame(String text) { | ||||
|   public TextSocketFrame(String text) { | ||||
|     super(fromText(text)); | ||||
|   } | ||||
| 
 | ||||
| @ -32,7 +32,7 @@ public class TextWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public TextWebSocketFrame(ByteBuf binaryData) { | ||||
|   public TextSocketFrame(ByteBuf binaryData) { | ||||
|     super(binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -46,7 +46,7 @@ public class TextWebSocketFrame extends WebSocketFrame { | ||||
|    * @param text | ||||
|    *            String to put in the frame | ||||
|    */ | ||||
|   public TextWebSocketFrame(boolean finalFragment, int rsv, String text) { | ||||
|   public TextSocketFrame(boolean finalFragment, int rsv, String text) { | ||||
|     super(finalFragment, rsv, fromText(text)); | ||||
|   } | ||||
| 
 | ||||
| @ -68,7 +68,7 @@ public class TextWebSocketFrame extends WebSocketFrame { | ||||
|    * @param binaryData | ||||
|    *            the content of the frame. | ||||
|    */ | ||||
|   public TextWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|   public TextSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData) { | ||||
|     super(finalFragment, rsv, binaryData); | ||||
|   } | ||||
| 
 | ||||
| @ -80,45 +80,45 @@ public class TextWebSocketFrame extends WebSocketFrame { | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame copy() { | ||||
|     return (TextWebSocketFrame) super.copy(); | ||||
|   public TextSocketFrame copy() { | ||||
|     return (TextSocketFrame) super.copy(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame duplicate() { | ||||
|     return (TextWebSocketFrame) super.duplicate(); | ||||
|   public TextSocketFrame duplicate() { | ||||
|     return (TextSocketFrame) super.duplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame retainedDuplicate() { | ||||
|     return (TextWebSocketFrame) super.retainedDuplicate(); | ||||
|   public TextSocketFrame retainedDuplicate() { | ||||
|     return (TextSocketFrame) super.retainedDuplicate(); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame replace(ByteBuf content) { | ||||
|     return new TextWebSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   public TextSocketFrame replace(ByteBuf content) { | ||||
|     return new TextSocketFrame(isFinalFragment(), rsv(), content); | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame retain() { | ||||
|   public TextSocketFrame retain() { | ||||
|     super.retain(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame retain(int increment) { | ||||
|   public TextSocketFrame retain(int increment) { | ||||
|     super.retain(increment); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame touch() { | ||||
|   public TextSocketFrame touch() { | ||||
|     super.touch(); | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   @Override | ||||
|   public TextWebSocketFrame touch(Object hint) { | ||||
|   public TextSocketFrame touch(Object hint) { | ||||
|     super.touch(hint); | ||||
|     return this; | ||||
|   } | ||||
| @ -17,19 +17,19 @@ public class Utf8FrameValidator extends ChannelInboundHandlerAdapter { | ||||
| 
 | ||||
|   @Override | ||||
|   public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { | ||||
|     if (msg instanceof WebSocketFrame) { | ||||
|       WebSocketFrame frame = (WebSocketFrame) msg; | ||||
|     if (msg instanceof SocketFrame) { | ||||
|       SocketFrame frame = (SocketFrame) msg; | ||||
| 
 | ||||
|       // Processing for possible fragmented messages for text and binary | ||||
|       // frames | ||||
|       if (((WebSocketFrame) msg).isFinalFragment()) { | ||||
|       if (((SocketFrame) msg).isFinalFragment()) { | ||||
|         // Final frame of the sequence. Apparently ping frames are | ||||
|         // allowed in the middle of a fragmented message | ||||
|         if (!(frame instanceof PingWebSocketFrame)) { | ||||
|         if (!(frame instanceof PingSocketFrame)) { | ||||
|           fragmentedFramesCount = 0; | ||||
| 
 | ||||
|           // Check text for UTF8 correctness | ||||
|           if ((frame instanceof TextWebSocketFrame) || (utf8Validator != null && utf8Validator.isChecking())) { | ||||
|           if ((frame instanceof TextSocketFrame) || (utf8Validator != null && utf8Validator.isChecking())) { | ||||
|             // Check UTF-8 correctness for this payload | ||||
|             checkUTF8String(ctx, frame.content()); | ||||
| 
 | ||||
| @ -43,7 +43,7 @@ public class Utf8FrameValidator extends ChannelInboundHandlerAdapter { | ||||
|         // fragmented sequence | ||||
|         if (fragmentedFramesCount == 0) { | ||||
|           // First text or binary frame for a fragmented set | ||||
|           if (frame instanceof TextWebSocketFrame) { | ||||
|           if (frame instanceof TextSocketFrame) { | ||||
|             checkUTF8String(ctx, frame.content()); | ||||
|           } | ||||
|         } else { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user