Class ServerHttp1StreamDuplexer
- java.lang.Object
-
- org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
- org.apache.hc.core5.http.impl.nio.ServerHttp1StreamDuplexer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpConnection,SocketModalCloseable,ModalCloseable,Identifiable
@Internal public class ServerHttp1StreamDuplexer extends AbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
I/O event handler for events fired byProtocolIOSessionthat implements server side HTTP/1.1 messaging protocol with full support for duplexed message transmission and message pipelining.- Since:
- 5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classServerHttp1StreamDuplexer.DelayedOutputChannel-
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 HandlerFactory<AsyncServerExchangeHandler>exchangeHandlerFactoryprivate Http1Confighttp1Configprivate HttpProcessorhttpProcessorprivate ServerHttp1StreamHandlerincomingprivate ServerHttp1StreamHandleroutgoingprivate Http1StreamChannel<HttpResponse>outputChannelprivate java.util.Queue<ServerHttp1StreamHandler>pipelineprivate java.lang.Stringschemeprivate Http1StreamListenerstreamListener
-
Constructor Summary
Constructors Constructor Description ServerHttp1StreamDuplexer(ProtocolIOSession ioSession, HttpProcessor httpProcessor, HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory, java.lang.String scheme, Http1Config http1Config, CharCodingConfig charCodingConfig, ConnectionReuseStrategy connectionReuseStrategy, NHttpMessageParser<HttpRequest> incomingMessageParser, NHttpMessageWriter<HttpResponse> 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(HttpRequest request, 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(HttpRequest request)protected booleanhandleOutgoingMessage(HttpResponse response)(package private) booleanhandleTimeout()(package private) voidinputEnd()(package private) booleaninputIdle()(package private) booleanisOutputReady()(package private) voidoutputEnd()(package private) booleanoutputIdle()(package private) HttpRequestparseMessageHead(boolean endOfStream)(package private) voidproduceOutput()(package private) voidterminate(java.lang.Exception exception)(package private) voidterminateExchange(HttpException ex)java.lang.StringtoString()(package private) voidupdateCapacity(CapacityChannel capacityChannel)(package private) voidupdateInputMetrics(HttpRequest request, BasicHttpConnectionMetrics connMetrics)(package private) voidupdateOutputMetrics(HttpResponse response, 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, requestSessionInput, requestSessionOutput, requestShutdown, setSessionTimeout, setSocketTimeout, shutdownSession, shutdownSession, streamOutput, suspendSessionInput, suspendSessionOutput
-
-
-
-
Field Detail
-
scheme
private final java.lang.String scheme
-
httpProcessor
private final HttpProcessor httpProcessor
-
exchangeHandlerFactory
private final HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory
-
http1Config
private final Http1Config http1Config
-
connectionReuseStrategy
private final ConnectionReuseStrategy connectionReuseStrategy
-
streamListener
private final Http1StreamListener streamListener
-
pipeline
private final java.util.Queue<ServerHttp1StreamHandler> pipeline
-
outputChannel
private final Http1StreamChannel<HttpResponse> outputChannel
-
outgoing
private volatile ServerHttp1StreamHandler outgoing
-
incoming
private volatile ServerHttp1StreamHandler incoming
-
-
Constructor Detail
-
ServerHttp1StreamDuplexer
public ServerHttp1StreamDuplexer(ProtocolIOSession ioSession, HttpProcessor httpProcessor, HandlerFactory<AsyncServerExchangeHandler> exchangeHandlerFactory, java.lang.String scheme, Http1Config http1Config, CharCodingConfig charCodingConfig, ConnectionReuseStrategy connectionReuseStrategy, NHttpMessageParser<HttpRequest> incomingMessageParser, NHttpMessageWriter<HttpResponse> outgoingMessageWriter, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, Http1StreamListener streamListener)
-
-
Method Detail
-
terminate
void terminate(java.lang.Exception exception)
- Specified by:
terminatein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
disconnected
void disconnected()
- Specified by:
disconnectedin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
updateInputMetrics
void updateInputMetrics(HttpRequest request, BasicHttpConnectionMetrics connMetrics)
- Specified by:
updateInputMetricsin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
updateOutputMetrics
void updateOutputMetrics(HttpResponse response, BasicHttpConnectionMetrics connMetrics)
- Specified by:
updateOutputMetricsin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
handleIncomingMessage
protected boolean handleIncomingMessage(HttpRequest request) throws HttpException
- Specified by:
handleIncomingMessagein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpException
-
createContentDecoder
protected ContentDecoder createContentDecoder(long len, java.nio.channels.ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException
- Specified by:
createContentDecoderin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpException
-
handleOutgoingMessage
protected boolean handleOutgoingMessage(HttpResponse response) throws HttpException
- Specified by:
handleOutgoingMessagein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpException
-
createContentEncoder
protected ContentEncoder createContentEncoder(long len, java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException
- Specified by:
createContentEncoderin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpException
-
inputIdle
boolean inputIdle()
- Specified by:
inputIdlein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
outputIdle
boolean outputIdle()
- Specified by:
outputIdlein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
parseMessageHead
HttpRequest parseMessageHead(boolean endOfStream) throws java.io.IOException, HttpException
- Overrides:
parseMessageHeadin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
java.io.IOExceptionHttpException
-
terminateExchange
void terminateExchange(HttpException ex) throws HttpException, java.io.IOException
- Throws:
HttpExceptionjava.io.IOException
-
consumeHeader
void consumeHeader(HttpRequest request, EntityDetails entityDetails) throws HttpException, java.io.IOException
- Specified by:
consumeHeaderin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
consumeData
void consumeData(java.nio.ByteBuffer src) throws HttpException, java.io.IOException- Specified by:
consumeDatain classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
updateCapacity
void updateCapacity(CapacityChannel capacityChannel) throws HttpException, java.io.IOException
- Specified by:
updateCapacityin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
dataEnd
void dataEnd(java.util.List<? extends Header> trailers) throws HttpException, java.io.IOException
- Specified by:
dataEndin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
inputEnd
void inputEnd() throws HttpException, java.io.IOException- Specified by:
inputEndin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
execute
void execute(RequestExecutionCommand executionCommand) throws HttpException
- Specified by:
executein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpException
-
isOutputReady
boolean isOutputReady()
- Specified by:
isOutputReadyin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
produceOutput
void produceOutput() throws HttpException, java.io.IOException- Specified by:
produceOutputin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
outputEnd
void outputEnd() throws HttpException, java.io.IOException- Specified by:
outputEndin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>- Throws:
HttpExceptionjava.io.IOException
-
handleTimeout
boolean handleTimeout()
- Specified by:
handleTimeoutin classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
appendState
void appendState(java.lang.StringBuilder buf)
- Overrides:
appendStatein classAbstractHttp1StreamDuplexer<HttpRequest,HttpResponse>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-