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 byProtocolIOSessionthat 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 ConnectionReuseStrategyconnectionReuseStrategyprivate Http1Confighttp1Configprivate HttpProcessorhttpProcessorprivate ClientHttp1StreamHandlerincomingprivate ClientHttp1StreamHandleroutgoingprivate Http1StreamChannel<HttpRequest>outputChannelprivate java.util.Queue<ClientHttp1StreamHandler>pipelineprivate Http1StreamListenerstreamListener
-
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) voidappendState(java.lang.StringBuilder buf)(package private) voidconsumeData(java.nio.ByteBuffer src)(package private) voidconsumeHeader(HttpResponse response, EntityDetails entityDetails)protected ContentDecodercreateContentDecoder(long len, java.nio.channels.ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics)protected ContentEncodercreateContentEncoder(long len, java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics)(package private) voiddataEnd(java.util.List<? extends Header> trailers)(package private) voiddisconnected()(package private) voidexecute(RequestExecutionCommand executionCommand)protected booleanhandleIncomingMessage(HttpResponse response)protected booleanhandleOutgoingMessage(HttpRequest request)(package private) booleanhandleTimeout()(package private) voidinputEnd()(package private) booleaninputIdle()(package private) booleanisOutputReady()(package private) voidoutputEnd()(package private) booleanoutputIdle()(package private) voidproduceOutput()(package private) voidterminate(java.lang.Exception exception)java.lang.StringtoString()(package private) voidupdateCapacity(CapacityChannel capacityChannel)(package private) voidupdateInputMetrics(HttpResponse response, BasicHttpConnectionMetrics connMetrics)(package private) voidupdateOutputMetrics(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:
terminatein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
disconnected
void disconnected()
- Specified by:
disconnectedin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
updateInputMetrics
void updateInputMetrics(HttpResponse response, BasicHttpConnectionMetrics connMetrics)
- Specified by:
updateInputMetricsin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
updateOutputMetrics
void updateOutputMetrics(HttpRequest request, BasicHttpConnectionMetrics connMetrics)
- Specified by:
updateOutputMetricsin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
handleIncomingMessage
protected boolean handleIncomingMessage(HttpResponse response) throws HttpException
- Specified by:
handleIncomingMessagein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpException
-
createContentDecoder
protected ContentDecoder createContentDecoder(long len, java.nio.channels.ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException
- Specified by:
createContentDecoderin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpException
-
handleOutgoingMessage
protected boolean handleOutgoingMessage(HttpRequest request) throws HttpException
- Specified by:
handleOutgoingMessagein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpException
-
createContentEncoder
protected ContentEncoder createContentEncoder(long len, java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException
- Specified by:
createContentEncoderin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpException
-
inputIdle
boolean inputIdle()
- Specified by:
inputIdlein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
outputIdle
boolean outputIdle()
- Specified by:
outputIdlein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
outputEnd
void outputEnd() throws HttpException, java.io.IOException- Specified by:
outputEndin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
execute
void execute(RequestExecutionCommand executionCommand) throws HttpException, java.io.IOException
- Specified by:
executein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
isOutputReady
boolean isOutputReady()
- Specified by:
isOutputReadyin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
produceOutput
void produceOutput() throws HttpException, java.io.IOException- Specified by:
produceOutputin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
consumeHeader
void consumeHeader(HttpResponse response, EntityDetails entityDetails) throws HttpException, java.io.IOException
- Specified by:
consumeHeaderin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
consumeData
void consumeData(java.nio.ByteBuffer src) throws HttpException, java.io.IOException- Specified by:
consumeDatain classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
updateCapacity
void updateCapacity(CapacityChannel capacityChannel) throws HttpException, java.io.IOException
- Specified by:
updateCapacityin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
dataEnd
void dataEnd(java.util.List<? extends Header> trailers) throws HttpException, java.io.IOException
- Specified by:
dataEndin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
inputEnd
void inputEnd() throws HttpException, java.io.IOException- Specified by:
inputEndin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>- Throws:
HttpExceptionjava.io.IOException
-
handleTimeout
boolean handleTimeout()
- Specified by:
handleTimeoutin classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
appendState
void appendState(java.lang.StringBuilder buf)
- Overrides:
appendStatein classAbstractHttp1StreamDuplexer<HttpResponse,HttpRequest>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-