public class ConnectionImpl extends Object implements Connection
| Constructor and Description |
|---|
ConnectionImpl(NettyHttp2Handler nettyHttp2Handler,
io.netty.channel.ChannelHandlerContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close connection
|
Object |
getProperty(io.netty.handler.codec.http2.Http2Connection.PropertyKey key)
get property
|
io.netty.handler.codec.http2.Http2Connection.PropertyKey |
getPropertyKey(String keyName)
get property key
|
ConnectionStatus |
getStatus()
get connection status
|
boolean |
isAuthorized()
is connection authorized
|
void |
onConnectionClosed()
callback when connection closed
|
int |
onDataRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
io.netty.buffer.ByteBuf data,
int padding,
boolean endOfStream)
callback for DataFrame
|
void |
onError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause)
callback when error occurs
|
void |
onGoAwayRead(io.netty.channel.ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
io.netty.buffer.ByteBuf debugData)
callback for GoAway
|
void |
onHeadersRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
io.netty.handler.codec.http2.Http2Headers headers,
int streamDependency,
short weight,
boolean exclusive,
int padding,
boolean endOfStream)
callback for HeaderFrame
|
void |
onRstStreamRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
long errorCode)
callback for rst
|
void |
onSettingsRead(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Settings settings)
callback for SettingFrame
|
void |
onUnknownFrame(io.netty.channel.ChannelHandlerContext ctx,
byte frameType,
int streamId,
io.netty.handler.codec.http2.Http2Flags flags,
io.netty.buffer.ByteBuf payload)
callback for Unknown Frame
|
void |
removeConnectListener()
remove connection listener
|
void |
setConnectionListener(ConnectionListener listener)
set listener for connection
|
void |
setDefaultStreamListener(Http2StreamListener http2StreamListener)
set default stream listener
|
void |
setProperty(io.netty.handler.codec.http2.Http2Connection.PropertyKey key,
Object object)
set property
|
void |
setStatus(ConnectionStatus status)
set connection status
|
String |
toString() |
CompletableFuture<StreamWriteContext> |
writeData(int streamId,
byte[] data,
boolean endStream)
write DATA frame
|
CompletableFuture<Connection> |
writeGoAway(int lastStreamId,
int errorCode,
byte[] debugData)
write GoAway frame
|
CompletableFuture<StreamWriteContext> |
writeHeaders(io.netty.handler.codec.http2.Http2Headers headers,
boolean endStream,
Http2StreamListener http2StreamListener)
start a new stream and write Header Frame
|
CompletableFuture<Connection> |
writeRst(int streamId,
int errorCode)
write RST_STEAM frame
|
public ConnectionImpl(NettyHttp2Handler nettyHttp2Handler, io.netty.channel.ChannelHandlerContext ctx)
public int onDataRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
io.netty.buffer.ByteBuf data,
int padding,
boolean endOfStream)
ConnectionReaderonDataRead in interface ConnectionReaderctx - contextstreamId - streamIddata - datapadding - paddingendOfStream - end of streampublic void onHeadersRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
io.netty.handler.codec.http2.Http2Headers headers,
int streamDependency,
short weight,
boolean exclusive,
int padding,
boolean endOfStream)
ConnectionReaderonHeadersRead in interface ConnectionReaderctx - contextstreamId - streamIdheaders - http2 HeaderstreamDependency - stream dependencyweight - weightexclusive - exclusivepadding - paddingendOfStream - end of streampublic void setConnectionListener(ConnectionListener listener)
ConnectionsetConnectionListener in interface Connectionlistener - ConnectionListenerpublic void removeConnectListener()
ConnectionremoveConnectListener in interface Connectionpublic void onSettingsRead(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http2.Http2Settings settings)
ConnectionReaderonSettingsRead in interface ConnectionReaderctx - contextsettings - http2 settingpublic void onGoAwayRead(io.netty.channel.ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
io.netty.buffer.ByteBuf debugData)
ConnectionReaderonGoAwayRead in interface ConnectionReaderctx - ctxlastStreamId - lastStreamIderrorCode - errorCodedebugData - debugDatapublic void onRstStreamRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
long errorCode)
ConnectionReaderonRstStreamRead in interface ConnectionReaderctx - ctxstreamId - streamIderrorCode - errorCodepublic void onUnknownFrame(io.netty.channel.ChannelHandlerContext ctx,
byte frameType,
int streamId,
io.netty.handler.codec.http2.Http2Flags flags,
io.netty.buffer.ByteBuf payload)
ConnectionReaderonUnknownFrame in interface ConnectionReaderctx - ctxframeType - frameTypestreamId - streamIdflags - flagspayload - payloadpublic void onConnectionClosed()
ConnectiononConnectionClosed in interface Connectionpublic void setStatus(ConnectionStatus status)
ConnectionsetStatus in interface Connectionstatus - statuspublic ConnectionStatus getStatus()
ConnectiongetStatus in interface Connectionpublic boolean isAuthorized()
ConnectionisAuthorized in interface Connectionpublic void onError(io.netty.channel.ChannelHandlerContext ctx,
boolean outbound,
Throwable cause)
ConnectiononError in interface Connectionctx - ctxoutbound - outboundcause - causepublic io.netty.handler.codec.http2.Http2Connection.PropertyKey getPropertyKey(String keyName)
ConnectiongetPropertyKey in interface ConnectionkeyName - keyNamepublic void setProperty(io.netty.handler.codec.http2.Http2Connection.PropertyKey key,
Object object)
ConnectionsetProperty in interface Connectionkey - propertyKeyobject - objectpublic Object getProperty(io.netty.handler.codec.http2.Http2Connection.PropertyKey key)
ConnectiongetProperty in interface Connectionkey - propertyKeypublic void setDefaultStreamListener(Http2StreamListener http2StreamListener)
ConnectionsetDefaultStreamListener in interface Connectionhttp2StreamListener - listenerpublic void close()
Connectionclose in interface Connectionpublic CompletableFuture<StreamWriteContext> writeHeaders(io.netty.handler.codec.http2.Http2Headers headers, boolean endStream, Http2StreamListener http2StreamListener)
ConnectionWriterwriteHeaders in interface ConnectionWriterheaders - headersendStream - end of streamhttp2StreamListener - stream listenerpublic CompletableFuture<StreamWriteContext> writeData(int streamId, byte[] data, boolean endStream)
ConnectionWriterwriteData in interface ConnectionWriterstreamId - streamIddata - dataendStream - end of streampublic CompletableFuture<Connection> writeRst(int streamId, int errorCode)
ConnectionWriterwriteRst in interface ConnectionWriterstreamId - streamIderrorCode - errorCodepublic CompletableFuture<Connection> writeGoAway(int lastStreamId, int errorCode, byte[] debugData)
ConnectionWriterwriteGoAway in interface ConnectionWriterlastStreamId - lastStreamIderrorCode - errorCodedebugData - debugDataCopyright © 2019. All rights reserved.