public class ConnectionHeadersFilterLayer extends FilterLayer
Modifier and Type | Class and Description |
---|---|
static interface |
ConnectionHeadersFilterLayer.Listener
A listener for the connection headers.
|
ProtocolLayer.Recv, ProtocolLayer.Send
EMPTY_BUFFER
Constructor and Description |
---|
ConnectionHeadersFilterLayer(Map<String,String> headers,
ConnectionHeadersFilterLayer.Listener listener)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
complete() |
void |
doSend(ByteBuffer data)
SPI: Sends data to the lower layer.
|
boolean |
isRecvOpen()
Tracks if this layer is accepting received data via
ProtocolLayer.Recv.onRecv(ByteBuffer) . |
boolean |
isSendOpen()
Tracks if this layer is submitting data to be sent via
ProtocolLayer.Send.doSend(ByteBuffer) . |
void |
onRecv(ByteBuffer data)
SPI: Callback on data being received from the lower layer.
|
void |
onRecvClosed(IOException cause)
Callback on the lower layer's source of data being closed.
|
void |
start()
Starts this layer.
|
abort, completed, doCloseSend, flushRecv, flushSend, init, next, stack
public ConnectionHeadersFilterLayer(Map<String,String> headers, ConnectionHeadersFilterLayer.Listener listener)
headers
- Our headers to send.listener
- Our listener to decide the response to the remote headers.public void start()
start
in interface ProtocolLayer
start
in class FilterLayer
public void onRecv(@NonNull ByteBuffer data) throws IOException
onRecv
in interface ProtocolLayer.Recv
onRecv
in class FilterLayer
data
- the data received. Any data consumed from the ByteBuffer
can be assumed as processed.
Any data not consumed from the ByteBuffer
will be the responsibility of the caller
to resubmit in subsequent calls.IOException
- if there was an error during processing of the received data.protected void complete()
public void onRecvClosed(IOException cause) throws IOException
onRecvClosed
in interface ProtocolLayer.Recv
onRecvClosed
in class FilterLayer
cause
- the cause of the lower layer being closed or null
.IOException
- if there was an error during the processing of the close notification.public boolean isRecvOpen()
ProtocolLayer.Recv.onRecv(ByteBuffer)
.
Once this method returns false
it must always return false
and can be assumed to behave in
this way.isRecvOpen
in interface ProtocolLayer.Recv
isRecvOpen
in class FilterLayer
true
if accepting received data via ProtocolLayer.Recv.onRecv(ByteBuffer)
.public void doSend(@NonNull ByteBuffer data) throws IOException
doSend
in interface ProtocolLayer.Send
doSend
in class FilterLayer
data
- the data to send. Any data consumed from the ByteBuffer
can be assumed as processed.
Any data not consumed from the ByteBuffer
will be the responsibility of the caller
to resubmit in subsequent calls.IOException
- if there was an error during processing of the data.public boolean isSendOpen()
ProtocolLayer.Send.doSend(ByteBuffer)
.
Once this method returns false
it must always return false
and can be assumed to behave in
this way.isSendOpen
in interface ProtocolLayer.Send
isSendOpen
in class FilterLayer
true
if submitting data to be sent via ProtocolLayer.Send.doSend(ByteBuffer)
.Copyright © 2004–2022. All rights reserved.