Package org.apache.tomcat.util.net
Class AprEndpoint.AprSocketWrapper
- java.lang.Object
-
- org.apache.tomcat.util.net.SocketWrapperBase<Long>
-
- org.apache.tomcat.util.net.AprEndpoint.AprSocketWrapper
-
- Enclosing class:
- AprEndpoint
public static class AprEndpoint.AprSocketWrapper extends SocketWrapperBase<Long>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.tomcat.util.net.SocketWrapperBase
SocketWrapperBase.BlockingMode, SocketWrapperBase.CompletionCheck, SocketWrapperBase.CompletionHandlerCall, SocketWrapperBase.CompletionState, SocketWrapperBase.OperationState<A>, SocketWrapperBase.VectoredIOCompletionHandler<A>
-
-
Field Summary
-
Fields inherited from class org.apache.tomcat.util.net.SocketWrapperBase
bufferedWriteSize, closed, COMPLETE_READ, COMPLETE_READ_WITH_COMPLETION, COMPLETE_WRITE, COMPLETE_WRITE_WITH_COMPLETION, localAddr, localName, localPort, nonBlockingWriteBuffer, previousIOException, READ_DATA, readOperation, readPending, remoteAddr, remoteHost, remotePort, sm, socketBufferHandler, writeOperation, writePending
-
-
Constructor Summary
Constructors Constructor Description AprSocketWrapper(Long socket, AprEndpoint endpoint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SendfileDataBasecreateSendfileData(String filename, long pos, long length)voiddoClientAuth(SSLSupport sslSupport)Require the client to perform CLIENT-CERT authentication if it hasn't already done so.protected voiddoClose()Perform the actual close.protected voiddoWrite(boolean block, ByteBuffer from)Write the contents of the ByteBuffer to the socket.booleangetBlockingStatus()LockgetBlockingStatusReadLock()ReentrantReadWriteLock.WriteLockgetBlockingStatusWriteLock()SSLSupportgetSslSupport(String clientCertProvider)booleanisReadyForRead()protected <A> SocketWrapperBase.OperationState<A>newOperationState(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long,? super A> handler, Semaphore semaphore, SocketWrapperBase.VectoredIOCompletionHandler<A> completion)protected voidpopulateLocalAddr()protected voidpopulateLocalName()protected voidpopulateLocalPort()protected voidpopulateRemoteAddr()protected voidpopulateRemoteHost()protected voidpopulateRemotePort()SendfileStateprocessSendfile(SendfileDataBase sendfileData)Starts the sendfile process.intread(boolean block, byte[] b, int off, int len)intread(boolean block, ByteBuffer to)voidregisterReadInterest()voidregisterWriteInterest()voidsetAppReadBufHandler(ApplicationBufferHandler handler)voidsetBlockingStatus(boolean blockingStatus)-
Methods inherited from class org.apache.tomcat.util.net.SocketWrapperBase
awaitReadComplete, awaitWriteComplete, buffersArrayHasRemaining, canWrite, checkError, close, decrementKeepAlive, doWrite, execute, flush, flushBlocking, flushNonBlocking, getCurrentProcessor, getEndpoint, getError, getLocalAddr, getLocalName, getLocalPort, getNegotiatedProtocol, getReadTimeout, getRemoteAddr, getRemoteHost, getRemotePort, getSocket, getSocketBufferHandler, getWriteTimeout, hasAsyncIO, hasDataToRead, hasDataToWrite, hasPerOperationTimeout, isClosed, isReadPending, isReadyForWrite, isSecure, isUpgraded, isWritePending, needSemaphores, populateReadBuffer, populateReadBuffer, processSocket, read, read, read, reset, setCurrentProcessor, setError, setKeepAliveLeft, setNegotiatedProtocol, setReadTimeout, setSecure, setUpgraded, setWriteTimeout, takeCurrentProcessor, toString, transfer, transfer, unRead, vectoredOperation, write, write, write, write, write, writeBlocking, writeBlocking, writeNonBlocking, writeNonBlocking, writeNonBlockingInternal
-
-
-
-
Constructor Detail
-
AprSocketWrapper
public AprSocketWrapper(Long socket, AprEndpoint endpoint)
-
-
Method Detail
-
getBlockingStatus
public boolean getBlockingStatus()
-
setBlockingStatus
public void setBlockingStatus(boolean blockingStatus)
-
getBlockingStatusReadLock
public Lock getBlockingStatusReadLock()
-
getBlockingStatusWriteLock
public ReentrantReadWriteLock.WriteLock getBlockingStatusWriteLock()
-
read
public int read(boolean block, byte[] b, int off, int len) throws IOException- Specified by:
readin classSocketWrapperBase<Long>- Throws:
IOException
-
read
public int read(boolean block, ByteBuffer to) throws IOException- Specified by:
readin classSocketWrapperBase<Long>- Throws:
IOException
-
isReadyForRead
public boolean isReadyForRead() throws IOException- Specified by:
isReadyForReadin classSocketWrapperBase<Long>- Throws:
IOException
-
doClose
protected void doClose()
Description copied from class:SocketWrapperBasePerform the actual close. The closed atomic boolean guarantees this will be called only once per wrapper.- Specified by:
doClosein classSocketWrapperBase<Long>
-
doWrite
protected void doWrite(boolean block, ByteBuffer from) throws IOExceptionDescription copied from class:SocketWrapperBaseWrite the contents of the ByteBuffer to the socket. For blocking writes either then entire contents of the buffer will be written or an IOException will be thrown. Partial blocking writes will not occur.- Specified by:
doWritein classSocketWrapperBase<Long>- Parameters:
block- Should the write be blocking or not?from- the ByteBuffer containing the data to be written- Throws:
IOException- If an I/O error such as a timeout occurs during the write
-
registerReadInterest
public void registerReadInterest()
- Specified by:
registerReadInterestin classSocketWrapperBase<Long>
-
registerWriteInterest
public void registerWriteInterest()
- Specified by:
registerWriteInterestin classSocketWrapperBase<Long>
-
createSendfileData
public SendfileDataBase createSendfileData(String filename, long pos, long length)
- Specified by:
createSendfileDatain classSocketWrapperBase<Long>
-
processSendfile
public SendfileState processSendfile(SendfileDataBase sendfileData)
Description copied from class:SocketWrapperBaseStarts the sendfile process. It is expected that if the sendfile process does not complete during this call and does not report an error, that the caller will not add the socket to the poller (or equivalent). That is the responsibility of this method.- Specified by:
processSendfilein classSocketWrapperBase<Long>- Parameters:
sendfileData- Data representing the file to send- Returns:
- The state of the sendfile process after the first write.
-
populateRemoteAddr
protected void populateRemoteAddr()
- Specified by:
populateRemoteAddrin classSocketWrapperBase<Long>
-
populateRemoteHost
protected void populateRemoteHost()
- Specified by:
populateRemoteHostin classSocketWrapperBase<Long>
-
populateRemotePort
protected void populateRemotePort()
- Specified by:
populateRemotePortin classSocketWrapperBase<Long>
-
populateLocalName
protected void populateLocalName()
- Specified by:
populateLocalNamein classSocketWrapperBase<Long>
-
populateLocalAddr
protected void populateLocalAddr()
- Specified by:
populateLocalAddrin classSocketWrapperBase<Long>
-
populateLocalPort
protected void populateLocalPort()
- Specified by:
populateLocalPortin classSocketWrapperBase<Long>
-
getSslSupport
public SSLSupport getSslSupport(String clientCertProvider)
- Specified by:
getSslSupportin classSocketWrapperBase<Long>
-
doClientAuth
public void doClientAuth(SSLSupport sslSupport) throws IOException
Description copied from class:SocketWrapperBaseRequire the client to perform CLIENT-CERT authentication if it hasn't already done so.- Specified by:
doClientAuthin classSocketWrapperBase<Long>- Parameters:
sslSupport- The SSL/TLS support instance currently being used by the connection that may need updating after the client authentication- Throws:
IOException- If authentication is required then there will be I/O with the client and this exception will be thrown if that goes wrong
-
setAppReadBufHandler
public void setAppReadBufHandler(ApplicationBufferHandler handler)
- Specified by:
setAppReadBufHandlerin classSocketWrapperBase<Long>
-
newOperationState
protected <A> SocketWrapperBase.OperationState<A> newOperationState(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long,? super A> handler, Semaphore semaphore, SocketWrapperBase.VectoredIOCompletionHandler<A> completion)
- Specified by:
newOperationStatein classSocketWrapperBase<Long>
-
-