Class ClientHttp1StreamDuplexer
- java.lang.Object
-
- org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
- org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,HttpConnection
,SocketModalCloseable
,ModalCloseable
,Identifiable
@Internal public class ClientHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
I/O event handler for events fired byProtocolIOSession
that implements client side HTTP/1.1 messaging protocol with full support for duplexed message transmission and message pipelining.- Since:
- 5.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer
AbstractHttp1StreamDuplexer.CapacityWindow, AbstractHttp1StreamDuplexer.MessageDelineation
-
-
Field Summary
Fields Modifier and Type Field Description private ConnectionReuseStrategy
connectionReuseStrategy
private Http1Config
http1Config
private HttpProcessor
httpProcessor
private ClientHttp1StreamHandler
incoming
private ClientHttp1StreamHandler
outgoing
private Http1StreamChannel<HttpRequest>
outputChannel
private java.util.Queue<ClientHttp1StreamHandler>
pipeline
private Http1StreamListener
streamListener
-
Constructor Summary
Constructors Constructor Description ClientHttp1StreamDuplexer(ProtocolIOSession ioSession, HttpProcessor httpProcessor, Http1Config http1Config, CharCodingConfig charCodingConfig, ConnectionReuseStrategy connectionReuseStrategy, NHttpMessageParser<HttpResponse> incomingMessageParser, NHttpMessageWriter<HttpRequest> outgoingMessageWriter, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, Http1StreamListener streamListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
appendState(java.lang.StringBuilder buf)
(package private) void
consumeData(java.nio.ByteBuffer src)
(package private) void
consumeHeader(HttpResponse response, EntityDetails entityDetails)
protected ContentDecoder
createContentDecoder(long len, java.nio.channels.ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics)
protected ContentEncoder
createContentEncoder(long len, java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics)
(package private) void
dataEnd(java.util.List<? extends Header> trailers)
(package private) void
disconnected()
(package private) void
execute(RequestExecutionCommand executionCommand)
protected boolean
handleIncomingMessage(HttpResponse response)
protected boolean
handleOutgoingMessage(HttpRequest request)
(package private) boolean
handleTimeout()
(package private) void
inputEnd()
(package private) boolean
inputIdle()
(package private) boolean
isOutputReady()
(package private) void
outputEnd()
(package private) boolean
outputIdle()
(package private) void
produceOutput()
(package private) void
terminate(java.lang.Exception exception)
java.lang.String
toString()
(package private) void
updateCapacity(CapacityChannel capacityChannel)
(package private) void
updateInputMetrics(HttpResponse response, BasicHttpConnectionMetrics connMetrics)
(package private) void
updateOutputMetrics(HttpRequest request, BasicHttpConnectionMetrics connMetrics)
-
Methods inherited from class org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer
close, close, commitMessageHead, endOutputStream, getEndpointDetails, getId, getLocalAddress, getProtocolVersion, getRemoteAddress, getSessionTimeout, getSocketTimeout, getSSLSession, isActive, isOpen, isOutputCompleted, isShuttingDown, onConnect, onDisconnect, onException, onInput, onOutput, onTimeout, parseMessageHead, requestSessionInput, requestSessionOutput, requestShutdown, setSessionTimeout, setSocketTimeout, shutdownSession, shutdownSession, streamOutput, suspendSessionInput, suspendSessionOutput
-
-
-
-
Field Detail
-
httpProcessor
private final HttpProcessor httpProcessor
-
connectionReuseStrategy
private final ConnectionReuseStrategy connectionReuseStrategy
-
http1Config
private final Http1Config http1Config
-
streamListener
private final Http1StreamListener streamListener
-
pipeline
private final java.util.Queue<ClientHttp1StreamHandler> pipeline
-
outputChannel
private final Http1StreamChannel<HttpRequest> outputChannel
-
outgoing
private volatile ClientHttp1StreamHandler outgoing
-
incoming
private volatile ClientHttp1StreamHandler incoming
-
-
Constructor Detail
-
ClientHttp1StreamDuplexer
public ClientHttp1StreamDuplexer(ProtocolIOSession ioSession, HttpProcessor httpProcessor, Http1Config http1Config, CharCodingConfig charCodingConfig, ConnectionReuseStrategy connectionReuseStrategy, NHttpMessageParser<HttpResponse> incomingMessageParser, NHttpMessageWriter<HttpRequest> outgoingMessageWriter, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, Http1StreamListener streamListener)
-
-
Method Detail
-
terminate
void terminate(java.lang.Exception exception)
- Specified by:
terminate
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
disconnected
void disconnected()
- Specified by:
disconnected
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
updateInputMetrics
void updateInputMetrics(HttpResponse response, BasicHttpConnectionMetrics connMetrics)
- Specified by:
updateInputMetrics
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
updateOutputMetrics
void updateOutputMetrics(HttpRequest request, BasicHttpConnectionMetrics connMetrics)
- Specified by:
updateOutputMetrics
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
handleIncomingMessage
protected boolean handleIncomingMessage(HttpResponse response) throws HttpException
- Specified by:
handleIncomingMessage
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
-
createContentDecoder
protected ContentDecoder createContentDecoder(long len, java.nio.channels.ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException
- Specified by:
createContentDecoder
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
-
handleOutgoingMessage
protected boolean handleOutgoingMessage(HttpRequest request) throws HttpException
- Specified by:
handleOutgoingMessage
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
-
createContentEncoder
protected ContentEncoder createContentEncoder(long len, java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException
- Specified by:
createContentEncoder
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
-
inputIdle
boolean inputIdle()
- Specified by:
inputIdle
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
outputIdle
boolean outputIdle()
- Specified by:
outputIdle
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
outputEnd
void outputEnd() throws HttpException, java.io.IOException
- Specified by:
outputEnd
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
execute
void execute(RequestExecutionCommand executionCommand) throws HttpException, java.io.IOException
- Specified by:
execute
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
isOutputReady
boolean isOutputReady()
- Specified by:
isOutputReady
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
produceOutput
void produceOutput() throws HttpException, java.io.IOException
- Specified by:
produceOutput
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
consumeHeader
void consumeHeader(HttpResponse response, EntityDetails entityDetails) throws HttpException, java.io.IOException
- Specified by:
consumeHeader
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
consumeData
void consumeData(java.nio.ByteBuffer src) throws HttpException, java.io.IOException
- Specified by:
consumeData
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
updateCapacity
void updateCapacity(CapacityChannel capacityChannel) throws HttpException, java.io.IOException
- Specified by:
updateCapacity
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
dataEnd
void dataEnd(java.util.List<? extends Header> trailers) throws HttpException, java.io.IOException
- Specified by:
dataEnd
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
inputEnd
void inputEnd() throws HttpException, java.io.IOException
- Specified by:
inputEnd
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
- Throws:
HttpException
java.io.IOException
-
handleTimeout
boolean handleTimeout()
- Specified by:
handleTimeout
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
appendState
void appendState(java.lang.StringBuilder buf)
- Overrides:
appendState
in classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-