Class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,OutgoingMessage extends HttpMessage>
java.lang.Object
org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer<IncomingMessage,OutgoingMessage>
- All Implemented Interfaces:
Closeable,AutoCloseable,HttpConnection,SocketModalCloseable,ModalCloseable,Identifiable
- Direct Known Subclasses:
ClientHttp1StreamDuplexer,ServerHttp1StreamDuplexer
abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,OutgoingMessage extends HttpMessage>
extends Object
implements Identifiable, HttpConnection
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classprivate static enum(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BasicHttpConnectionMetricsprivate final ByteBufferprivate EndpointDetailsprivate final Http1Configprivate final SessionInputBufferImplprivate final ContentLengthStrategyprivate Message<IncomingMessage, ContentDecoder> private final NHttpMessageParser<IncomingMessage> private final BasicHttpTransportMetricsprivate final ProtocolIOSessionprivate final SessionOutputBufferImplprivate final ContentLengthStrategyprivate Message<OutgoingMessage, ContentEncoder> private final NHttpMessageWriter<OutgoingMessage> private final AtomicIntegerprivate final BasicHttpTransportMetricsprivate ProtocolVersion -
Constructor Summary
ConstructorsConstructorDescriptionAbstractHttp1StreamDuplexer(ProtocolIOSession ioSession, Http1Config http1Config, CharCodingConfig charCodingConfig, NHttpMessageParser<IncomingMessage> incomingMessageParser, NHttpMessageWriter<OutgoingMessage> outgoingMessageWriter, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy) -
Method Summary
Modifier and TypeMethodDescription(package private) voidappendState(StringBuilder buf) voidclose()Closes this connection gracefully.voidCloses this process or endpoint and releases any system resources associated with it.(package private) voidcommitMessageHead(OutgoingMessage messageHead, boolean endStream, FlushMode flushMode) (package private) abstract voidconsumeData(ByteBuffer src) (package private) abstract voidconsumeHeader(IncomingMessage messageHead, EntityDetails entityDetails) (package private) abstract ContentDecodercreateContentDecoder(long contentLength, ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics) (package private) abstract ContentEncodercreateContentEncoder(long contentLength, WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics) (package private) abstract void(package private) abstract void(package private) AbstractHttp1StreamDuplexer.MessageDelineationendOutputStream(List<? extends Header> trailers) (package private) abstract voidexecute(RequestExecutionCommand executionCommand) Returns this connection's endpoint details.getId()Returns this connection's local address ornullif it is not bound yet.Returns this connection's protocol version ornullif unknown.Returns this connection's remote address ornullif it is not connected yet or unconnected.(package private) TimeoutReturns the socket timeout value.Returns this connection's SSL session ornullif TLS has not been activated.(package private) abstract booleanhandleIncomingMessage(IncomingMessage incomingMessage) (package private) abstract booleanhandleOutgoingMessage(OutgoingMessage outgoingMessage) (package private) abstract boolean(package private) abstract voidinputEnd()(package private) abstract boolean(package private) booleanisActive()booleanisOpen()Checks if this connection is open.(package private) boolean(package private) abstract boolean(package private) booleanfinal voidfinal voidfinal voidonException(Exception ex) final voidonInput(ByteBuffer src) final voidonOutput()final void(package private) abstract void(package private) abstract boolean(package private) IncomingMessageparseMessageHead(boolean endOfStream) private void(package private) abstract void(package private) void(package private) void(package private) voidrequestShutdown(CloseMode closeMode) (package private) voidsetSessionTimeout(Timeout timeout) voidsetSocketTimeout(Timeout timeout) Sets the socket timeout value.(package private) voidshutdownSession(Exception cause) (package private) voidshutdownSession(CloseMode closeMode) (package private) intstreamOutput(ByteBuffer src) (package private) void(package private) void(package private) abstract void(package private) abstract voidupdateCapacity(CapacityChannel capacityChannel) (package private) abstract voidupdateInputMetrics(IncomingMessage incomingMessage, BasicHttpConnectionMetrics connMetrics) (package private) abstract voidupdateOutputMetrics(OutgoingMessage outgoingMessage, BasicHttpConnectionMetrics connMetrics)
-
Field Details
-
ioSession
-
http1Config
-
inbuf
-
outbuf
-
inTransportMetrics
-
outTransportMetrics
-
connMetrics
-
incomingMessageParser
-
outgoingMessageWriter
-
incomingContentStrategy
-
outgoingContentStrategy
-
contentBuffer
-
outputRequests
-
incomingMessage
-
outgoingMessage
-
connState
-
capacityWindow
-
version
-
endpointDetails
-
-
Constructor Details
-
AbstractHttp1StreamDuplexer
AbstractHttp1StreamDuplexer(ProtocolIOSession ioSession, Http1Config http1Config, CharCodingConfig charCodingConfig, NHttpMessageParser<IncomingMessage> incomingMessageParser, NHttpMessageWriter<OutgoingMessage> outgoingMessageWriter, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy)
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceIdentifiable
-
isActive
boolean isActive() -
isShuttingDown
boolean isShuttingDown() -
shutdownSession
-
shutdownSession
-
disconnected
abstract void disconnected() -
terminate
-
updateInputMetrics
abstract void updateInputMetrics(IncomingMessage incomingMessage, BasicHttpConnectionMetrics connMetrics) -
updateOutputMetrics
abstract void updateOutputMetrics(OutgoingMessage outgoingMessage, BasicHttpConnectionMetrics connMetrics) -
consumeHeader
abstract void consumeHeader(IncomingMessage messageHead, EntityDetails entityDetails) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
handleIncomingMessage
- Throws:
HttpException
-
handleOutgoingMessage
- Throws:
HttpException
-
createContentDecoder
abstract ContentDecoder createContentDecoder(long contentLength, ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException - Throws:
HttpException
-
createContentEncoder
abstract ContentEncoder createContentEncoder(long contentLength, WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics) throws HttpException - Throws:
HttpException
-
consumeData
- Throws:
HttpExceptionIOException
-
updateCapacity
- Throws:
HttpExceptionIOException
-
dataEnd
- Throws:
HttpExceptionIOException
-
isOutputReady
abstract boolean isOutputReady() -
produceOutput
- Throws:
HttpExceptionIOException
-
execute
- Throws:
HttpExceptionIOException
-
inputEnd
- Throws:
HttpExceptionIOException
-
outputEnd
- Throws:
HttpExceptionIOException
-
inputIdle
abstract boolean inputIdle() -
outputIdle
abstract boolean outputIdle() -
handleTimeout
abstract boolean handleTimeout() -
processCommands
- Throws:
HttpExceptionIOException
-
onConnect
- Throws:
HttpExceptionIOException
-
parseMessageHead
- Throws:
IOExceptionHttpException
-
onInput
- Throws:
HttpExceptionIOException
-
onOutput
- Throws:
IOExceptionHttpException
-
onTimeout
- Throws:
IOExceptionHttpException
-
onException
-
onDisconnect
public final void onDisconnect() -
requestShutdown
-
commitMessageHead
void commitMessageHead(OutgoingMessage messageHead, boolean endStream, FlushMode flushMode) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
requestSessionInput
void requestSessionInput() -
requestSessionOutput
void requestSessionOutput() -
getSessionTimeout
Timeout getSessionTimeout() -
setSessionTimeout
-
suspendSessionInput
void suspendSessionInput() -
suspendSessionOutput
- Throws:
IOException
-
streamOutput
- Throws:
IOException
-
endOutputStream
AbstractHttp1StreamDuplexer.MessageDelineation endOutputStream(List<? extends Header> trailers) throws IOException - Throws:
IOException
-
isOutputCompleted
boolean isOutputCompleted() -
close
Description copied from interface:HttpConnectionCloses this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Useshutdowninstead.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceHttpConnection- Throws:
IOException
-
close
Description copied from interface:ModalCloseableCloses this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.- Specified by:
closein interfaceModalCloseable- Parameters:
closeMode- How to close the receiver.
-
isOpen
public boolean isOpen()Description copied from interface:HttpConnectionChecks if this connection is open.- Specified by:
isOpenin interfaceHttpConnection- Returns:
- true if it is open, false if it is closed.
-
getSocketTimeout
Description copied from interface:SocketModalCloseableReturns the socket timeout value.- Specified by:
getSocketTimeoutin interfaceSocketModalCloseable- Returns:
- timeout value.
-
setSocketTimeout
Description copied from interface:SocketModalCloseableSets the socket timeout value.- Specified by:
setSocketTimeoutin interfaceSocketModalCloseable- Parameters:
timeout- timeout value
-
getEndpointDetails
Description copied from interface:HttpConnectionReturns this connection's endpoint details.- Specified by:
getEndpointDetailsin interfaceHttpConnection- Returns:
- this connection's endpoint details.
-
getProtocolVersion
Description copied from interface:HttpConnectionReturns this connection's protocol version ornullif unknown.- Specified by:
getProtocolVersionin interfaceHttpConnection- Returns:
- this connection's protocol version or
nullif unknown.
-
getRemoteAddress
Description copied from interface:HttpConnectionReturns this connection's remote address ornullif it is not connected yet or unconnected.- Specified by:
getRemoteAddressin interfaceHttpConnection- Returns:
- this connection's remote address or
nullif it is not connected yet or unconnected.
-
getLocalAddress
Description copied from interface:HttpConnectionReturns this connection's local address ornullif it is not bound yet.- Specified by:
getLocalAddressin interfaceHttpConnection- Returns:
- this connection's local address or
nullif it is not bound yet.
-
getSSLSession
Description copied from interface:HttpConnectionReturns this connection's SSL session ornullif TLS has not been activated.- Specified by:
getSSLSessionin interfaceHttpConnection- Returns:
- this connection's SSL session or
nullif TLS has not been activated.
-
appendState
-