public class Http2Channel extends AbstractFramedChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel> implements Attachable
Modifier and Type | Field and Description |
---|---|
static String | CLEARTEXT_UPGRADE_STRING |
static int | DEFAULT_MAX_FRAME_SIZE |
static int | ERROR_CANCEL |
static int | ERROR_COMPRESSION_ERROR |
static int | ERROR_CONNECT_ERROR |
static int | ERROR_ENHANCE_YOUR_CALM |
static int | ERROR_FLOW_CONTROL_ERROR |
static int | ERROR_FRAME_SIZE_ERROR |
static int | ERROR_INADEQUATE_SECURITY |
static int | ERROR_INTERNAL_ERROR |
static int | ERROR_NO_ERROR |
static int | ERROR_PROTOCOL_ERROR |
static int | ERROR_REFUSED_STREAM |
static int | ERROR_SETTINGS_TIMEOUT |
static int | ERROR_STREAM_CLOSED |
static int | MAX_FRAME_SIZE |
static byte[] | PREFACE_BYTES |
Constructor and Description |
---|
Http2Channel(org.xnio.StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, boolean prefaceRequired, ByteBuffer initialOtherSideSettings, org.xnio.OptionMap settings) |
Http2Channel(org.xnio.StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, boolean prefaceRequired, org.xnio.OptionMap settings) |
Http2Channel(org.xnio.StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, org.xnio.OptionMap settings) |
Modifier and Type | Method and Description |
---|---|
<T> void | addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value) Add a value to a list-typed attachment key. |
protected void | closeSubChannels() Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed. |
protected AbstractHttp2StreamSourceChannel | createChannel(FrameHeaderData frameHeaderData, PooledByteBuffer frameData) Method that creates the actual stream source channel implementation that is in use. |
Http2HeadersStreamSinkChannel | createInitialUpgradeResponseStream() Creates a response stream to respond to the initial HTTP upgrade |
Http2HeadersStreamSinkChannel | createStream(HeaderMap requestHeaders) Creates a strema using a HEADERS frame |
<T> T | getAttachment(AttachmentKey<T> key) Get an attachment value. |
<T> List<T> | getAttachmentList(AttachmentKey<? extends List<T>> key) Gets a list attachment value. |
int | getHttp2Version() |
int | getInitialReceiveWindowSize() |
int | getInitialSendWindowSize() |
String | getProtocol() |
int | getReceiveMaxFrameSize() |
int | getSendMaxFrameSize() |
SSLSession | getSslSession() |
protected void | handleBrokenSinkChannel(Throwable e) Method that is invoked when then write side of a channel is broken. |
protected void | handleBrokenSourceChannel(Throwable e) Method that is invoked when the read side of the channel is broken. |
void | handleWindowUpdate(int streamId, int deltaWindowSize) |
boolean | isClient() |
protected boolean | isLastFrameReceived() Returns true if the protocol specific final frame has been received. |
protected boolean | isLastFrameSent() |
boolean | isPeerGoneAway() |
boolean | isPushEnabled() |
boolean | isThisGoneAway() |
protected void | lastDataRead() Method than is invoked when read() returns -1. |
protected FrameHeaderData | parseFrame(ByteBuffer data) Attempts to parse an incoming frame header from the data in the buffer. |
<T> T | putAttachment(AttachmentKey<T> key, T value) Set an attachment value. |
<T> T | removeAttachment(AttachmentKey<T> key) Remove an attachment, returning its previous value. |
void | sendGoAway(int status) |
void | sendGoAway(int status, org.xnio.ChannelExceptionHandler<AbstractHttp2StreamSinkChannel> exceptionHandler) |
void | sendPing(byte[] data) |
void | sendPing(byte[] data, org.xnio.ChannelExceptionHandler<AbstractHttp2StreamSinkChannel> exceptionHandler) |
Http2HeadersStreamSinkChannel | sendPushPromise(int associatedStreamId, HeaderMap requestHeaders, HeaderMap responseHeaders) |
void | sendRstStream(int streamId, int statusCode) |
void | sendUpdateWindowSize(int streamId, int delta) |
void | updateReceiveFlowControlWindow(int read) |
addCloseTask, close, createIdleTimeoutChannel, flushSenders, getBufferPool, getCloseSetter, getDestinationAddress, getFramePriority, getIdleTimeout, getIoThread, getLocalAddress, getLocalAddress, getOption, getPeerAddress, getPeerAddress, getReceiveSetter, getSourceAddress, getUnderlyingConnection, getWorker, isOpen, isReadsBroken, isReceivesResumed, isWritesBroken, markReadsBroken, markWritesBroken, queueFrame, recalculateHeldFrames, receive, resumeReceives, setIdleTimeout, setOption, supportsOption, suspendReceives, toString, writeExceptionHandler
public static final String CLEARTEXT_UPGRADE_STRING
public static final int ERROR_NO_ERROR
public static final int ERROR_PROTOCOL_ERROR
public static final int ERROR_INTERNAL_ERROR
public static final int ERROR_FLOW_CONTROL_ERROR
public static final int ERROR_SETTINGS_TIMEOUT
public static final int ERROR_STREAM_CLOSED
public static final int ERROR_FRAME_SIZE_ERROR
public static final int ERROR_REFUSED_STREAM
public static final int ERROR_CANCEL
public static final int ERROR_COMPRESSION_ERROR
public static final int ERROR_CONNECT_ERROR
public static final int ERROR_ENHANCE_YOUR_CALM
public static final int ERROR_INADEQUATE_SECURITY
public static final byte[] PREFACE_BYTES
public static final int DEFAULT_MAX_FRAME_SIZE
public static final int MAX_FRAME_SIZE
public Http2Channel(org.xnio.StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, org.xnio.OptionMap settings)
public Http2Channel(org.xnio.StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, boolean prefaceRequired, org.xnio.OptionMap settings)
public Http2Channel(org.xnio.StreamConnection connectedStreamChannel, String protocol, ByteBufferPool bufferPool, PooledByteBuffer data, boolean clientSide, boolean fromUpgrade, boolean prefaceRequired, ByteBuffer initialOtherSideSettings, org.xnio.OptionMap settings)
protected AbstractHttp2StreamSourceChannel createChannel(FrameHeaderData frameHeaderData, PooledByteBuffer frameData) throws IOException
AbstractFramedChannel
createChannel
in class AbstractFramedChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>
frameHeaderData
- The header data, as returned by AbstractFramedChannel.parseFrame(java.nio.ByteBuffer)
frameData
- Any additional data for the frame that has already been read. This may not be the complete frame contentsIOException
protected FrameHeaderData parseFrame(ByteBuffer data) throws IOException
AbstractFramedChannel
parseFrame
in class AbstractFramedChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>
data
- The data that has been read from the channelnull
if the data was incompleteIOException
- If the data could not be parsed.protected void lastDataRead()
AbstractFramedChannel
protected boolean isLastFrameReceived()
AbstractFramedChannel
isLastFrameReceived
in class AbstractFramedChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>
true
If the last frame has been receivedprotected boolean isLastFrameSent()
isLastFrameSent
in class AbstractFramedChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>
true
If the last frame has been sentprotected void handleBrokenSourceChannel(Throwable e)
AbstractFramedChannel
protected void handleBrokenSinkChannel(Throwable e)
AbstractFramedChannel
protected void closeSubChannels()
AbstractFramedChannel
closeSubChannels
in class AbstractFramedChannel<Http2Channel,AbstractHttp2StreamSourceChannel,AbstractHttp2StreamSinkChannel>
public int getHttp2Version()
public int getInitialSendWindowSize()
public int getInitialReceiveWindowSize()
public void handleWindowUpdate(int streamId, int deltaWindowSize) throws IOException
IOException
public void sendPing(byte[] data)
public void sendPing(byte[] data, org.xnio.ChannelExceptionHandler<AbstractHttp2StreamSinkChannel> exceptionHandler)
public void sendGoAway(int status)
public void sendGoAway(int status, org.xnio.ChannelExceptionHandler<AbstractHttp2StreamSinkChannel> exceptionHandler)
public void sendUpdateWindowSize(int streamId, int delta)
public SSLSession getSslSession()
public void updateReceiveFlowControlWindow(int read)
public Http2HeadersStreamSinkChannel createStream(HeaderMap requestHeaders) throws IOException
requestHeaders
- IOException
public Http2HeadersStreamSinkChannel sendPushPromise(int associatedStreamId, HeaderMap requestHeaders, HeaderMap responseHeaders) throws IOException
IOException
public boolean isClient()
public <T> T getAttachment(AttachmentKey<T> key)
Attachable
null
is returned.getAttachment
in interface Attachable
T
- the value typekey
- the attachment keynull
if there is nonepublic <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key)
Attachable
getAttachmentList
in interface Attachable
T
- the value typekey
- the attachment keypublic <T> T putAttachment(AttachmentKey<T> key, T value)
Attachable
null
, the attachment key is removed.putAttachment
in interface Attachable
T
- the value typekey
- the attachment keyvalue
- the new valuenull
if there was nonepublic <T> T removeAttachment(AttachmentKey<T> key)
Attachable
removeAttachment
in interface Attachable
T
- the value typekey
- the attachment keynull
if there was nonepublic <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value)
Attachable
addToAttachmentList
in interface Attachable
T
- the list value typekey
- the attachment keyvalue
- the value to addpublic void sendRstStream(int streamId, int statusCode)
public Http2HeadersStreamSinkChannel createInitialUpgradeResponseStream()
public boolean isPushEnabled()
public boolean isPeerGoneAway()
public boolean isThisGoneAway()
public int getReceiveMaxFrameSize()
public int getSendMaxFrameSize()
public String getProtocol()
Copyright © 2015 JBoss by Red Hat. All rights reserved.