public abstract class ProtocolHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Connection |
connection |
protected FilterChainContext |
ctx |
protected CharsetDecoder |
currentDecoder |
protected byte |
inFragmentedType |
protected WebSocketMappingData |
mappingData |
protected boolean |
maskData |
protected byte |
outFragmentedType |
protected boolean |
processingFragment |
protected ByteBuffer |
remainder |
protected Charset |
utf8 |
| Constructor and Description |
|---|
ProtocolHandler(boolean maskData) |
| Modifier and Type | Method and Description |
|---|---|
protected byte |
checkForLastFrame(DataFrame frame,
byte opcode) |
GrizzlyFuture<DataFrame> |
close(int code,
String reason) |
abstract HandShake |
createClientHandShake(URI uri) |
abstract HandShake |
createServerHandShake(HttpContent requestContent) |
long |
decodeLength(byte[] bytes)
Convert a byte[] to a long.
|
void |
doClose() |
byte[] |
encodeLength(long length)
Converts the length given to the appropriate framing data: 0-125 one element that is the payload length.
|
abstract byte[] |
frame(DataFrame frame) |
protected ByteBuffer |
getByteBuffer(byte[] data) |
Connection |
getConnection() |
FilterChainContext |
getFilterChainContext() |
protected WebSocketMappingData |
getMappingData() |
WebSocket |
getWebSocket() |
HandShake |
handshake(FilterChainContext ctx,
WebSocketApplication app,
HttpContent request) |
protected abstract boolean |
isControlFrame(byte opcode) |
boolean |
isMaskData() |
abstract DataFrame |
parse(Buffer buffer) |
GrizzlyFuture<DataFrame> |
send(byte[] data) |
GrizzlyFuture<DataFrame> |
send(DataFrame frame) |
GrizzlyFuture<DataFrame> |
send(DataFrame frame,
CompletionHandler<DataFrame> completionHandler) |
GrizzlyFuture<DataFrame> |
send(String data) |
void |
setConnection(Connection handler) |
void |
setFilterChainContext(FilterChainContext ctx) |
protected void |
setMappingData(WebSocketMappingData mappingData) |
void |
setWebSocket(WebSocket webSocket) |
GrizzlyFuture<DataFrame> |
stream(boolean last,
byte[] bytes,
int off,
int len) |
GrizzlyFuture<DataFrame> |
stream(boolean last,
String fragment) |
DataFrame |
toDataFrame(byte[] data) |
DataFrame |
toDataFrame(byte[] data,
boolean last) |
DataFrame |
toDataFrame(String data) |
DataFrame |
toDataFrame(String data,
boolean last) |
DataFrame |
unframe(Buffer buffer) |
protected void |
utf8Decode(boolean finalFragment,
byte[] data,
DataFrame dataFrame) |
protected void |
validate(byte fragmentType,
byte opcode) |
protected Connection connection
protected byte inFragmentedType
protected byte outFragmentedType
protected final boolean maskData
protected FilterChainContext ctx
protected boolean processingFragment
protected Charset utf8
protected CharsetDecoder currentDecoder
protected ByteBuffer remainder
protected WebSocketMappingData mappingData
public HandShake handshake(FilterChainContext ctx, WebSocketApplication app, HttpContent request)
public final GrizzlyFuture<DataFrame> send(DataFrame frame)
public GrizzlyFuture<DataFrame> send(DataFrame frame, CompletionHandler<DataFrame> completionHandler)
public Connection getConnection()
public void setConnection(Connection handler)
public FilterChainContext getFilterChainContext()
public void setFilterChainContext(FilterChainContext ctx)
protected WebSocketMappingData getMappingData()
protected void setMappingData(WebSocketMappingData mappingData)
public WebSocket getWebSocket()
public void setWebSocket(WebSocket webSocket)
public boolean isMaskData()
public abstract byte[] frame(DataFrame frame)
public DataFrame toDataFrame(byte[] data)
public DataFrame toDataFrame(byte[] data, boolean last)
public abstract HandShake createServerHandShake(HttpContent requestContent)
public GrizzlyFuture<DataFrame> send(byte[] data)
public GrizzlyFuture<DataFrame> send(String data)
public GrizzlyFuture<DataFrame> stream(boolean last, byte[] bytes, int off, int len)
public GrizzlyFuture<DataFrame> stream(boolean last, String fragment)
public GrizzlyFuture<DataFrame> close(int code, String reason)
public long decodeLength(byte[] bytes)
public byte[] encodeLength(long length)
length - the payload sizeprotected void validate(byte fragmentType,
byte opcode)
protected abstract boolean isControlFrame(byte opcode)
protected byte checkForLastFrame(DataFrame frame, byte opcode)
public void doClose()
protected void utf8Decode(boolean finalFragment,
byte[] data,
DataFrame dataFrame)
protected ByteBuffer getByteBuffer(byte[] data)
Copyright © 2015 Oracle Corporation. All Rights Reserved.