AprEndpoint.AprSocketWrapper (Apache Tomcat 9.0.81 API Documentation)

Package org.apache.tomcat.util.net

## Class AprEndpoint.AprSocketWrapper

- java.lang.Object
- - org.apache.tomcat.util.net.SocketWrapperBase<java.lang.Long>
  - - org.apache.tomcat.util.net.AprEndpoint.AprSocketWrapper

- Enclosing class:
    AprEndpoint

      public static class AprEndpoint.AprSocketWrapper
      extends SocketWrapperBase<java.lang.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​(java.lang.Long socket, AprEndpoint endpoint)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SendfileDataBase` | `createSendfileData​(java.lang.String filename, long pos, long length)` |
    `void` | `doClientAuth​(SSLSupport sslSupport)` | Require the client to perform CLIENT-CERT authentication if it hasn't already done so.
    `protected void` | `doClose()` | Perform the actual close.
    `protected void` | `doWrite​(boolean block, java.nio.ByteBuffer from)` | Write the contents of the ByteBuffer to the socket.
    `protected boolean` | `flushNonBlocking()` | Writes as much data as possible from any that remains in the buffers.
    `boolean` | `getBlockingStatus()` |
    `java.util.concurrent.locks.Lock` | `getBlockingStatusReadLock()` |
    `java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock` | `getBlockingStatusWriteLock()` |
    `SSLSupport` | `getSslSupport()` | Obtain an SSLSupport instance for this socket.
    `SSLSupport` | `getSslSupport​(java.lang.String clientCertProvider)` | Obtain an SSLSupport instance for this socket.
    `boolean` | `isReadyForRead()` |
    `protected <A> SocketWrapperBase.OperationState<A>` | `newOperationState​(boolean read, java.nio.ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, java.util.concurrent.TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, java.nio.channels.CompletionHandler<java.lang.Long,​? super A> handler, java.util.concurrent.Semaphore semaphore, SocketWrapperBase.VectoredIOCompletionHandler<A> completion)` |
    `protected void` | `populateLocalAddr()` |
    `protected void` | `populateLocalName()` |
    `protected void` | `populateLocalPort()` |
    `protected void` | `populateRemoteAddr()` |
    `protected void` | `populateRemoteHost()` |
    `protected void` | `populateRemotePort()` |
    `SendfileState` | `processSendfile​(SendfileDataBase sendfileData)` | Starts the sendfile process.
    `int` | `read​(boolean block, byte[] b, int off, int len)` |
    `int` | `read​(boolean block, java.nio.ByteBuffer to)` |
    `void` | `registerReadInterest()` |
    `void` | `registerWriteInterest()` |
    `void` | `setAppReadBufHandler​(ApplicationBufferHandler handler)` |
    `void` | `setBlockingStatus​(boolean blockingStatus)` |

    - ### Methods inherited from class org.apache.tomcat.util.net.SocketWrapperBase

      `awaitReadComplete, awaitWriteComplete, buffersArrayHasRemaining, canWrite, checkError, close, decrementKeepAlive, doWrite, execute, flush, flushBlocking, getCurrentProcessor, getEndpoint, getError, getLocalAddr, getLocalName, getLocalPort, getLock, 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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AprSocketWrapper

          public AprSocketWrapper​(java.lang.Long socket,
                                  AprEndpoint endpoint)

  - ### Method Detail

    - #### getBlockingStatus

          public boolean getBlockingStatus()

    - #### setBlockingStatus

          public void setBlockingStatus​(boolean blockingStatus)

    - #### getBlockingStatusReadLock

          public java.util.concurrent.locks.Lock getBlockingStatusReadLock()

    - #### getBlockingStatusWriteLock

          public java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock getBlockingStatusWriteLock()

    - #### read

          public int read​(boolean block,
                          byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException

      Specified by:
        `read` in class `SocketWrapperBase<java.lang.Long>`
      Throws:
        `java.io.IOException`

    - #### read

          public int read​(boolean block,
                          java.nio.ByteBuffer to)
                   throws java.io.IOException

      Specified by:
        `read` in class `SocketWrapperBase<java.lang.Long>`
      Throws:
        `java.io.IOException`

    - #### isReadyForRead

          public boolean isReadyForRead()
                                 throws java.io.IOException

      Specified by:
        `isReadyForRead` in class `SocketWrapperBase<java.lang.Long>`
      Throws:
        `java.io.IOException`

    - #### doClose

          protected void doClose()

      Description copied from class: `SocketWrapperBase`
      Perform the actual close. The closed atomic boolean guarantees this will be called only once per wrapper.
      Specified by:
        `doClose` in class `SocketWrapperBase<java.lang.Long>`

    - #### flushNonBlocking

          protected boolean flushNonBlocking()
                                      throws java.io.IOException

      Description copied from class: `SocketWrapperBase`
      Writes as much data as possible from any that remains in the buffers.
      Specified by:
        `flushNonBlocking` in class `SocketWrapperBase<java.lang.Long>`
      Returns:
        `true` if data remains to be flushed after this method completes, otherwise `false`.
      Throws:
        `java.io.IOException` - If an IO error occurs during the write

    - #### doWrite

          protected void doWrite​(boolean block,
                                 java.nio.ByteBuffer from)
                          throws java.io.IOException

      Description copied from class: `SocketWrapperBase`
      Write 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:
        `doWrite` in class `SocketWrapperBase<java.lang.Long>`
      Parameters:
        `block` - Should the write be blocking or not?
        `from` - the ByteBuffer containing the data to be written
      Throws:
        `java.io.IOException` - If an I/O error such as a timeout occurs during the write

    - #### registerReadInterest

          public void registerReadInterest()

      Specified by:
        `registerReadInterest` in class `SocketWrapperBase<java.lang.Long>`

    - #### registerWriteInterest

          public void registerWriteInterest()

      Specified by:
        `registerWriteInterest` in class `SocketWrapperBase<java.lang.Long>`

    - #### createSendfileData

          public SendfileDataBase createSendfileData​(java.lang.String filename,
                                                     long pos,
                                                     long length)

      Specified by:
        `createSendfileData` in class `SocketWrapperBase<java.lang.Long>`

    - #### processSendfile

          public SendfileState processSendfile​(SendfileDataBase sendfileData)

      Description copied from class: `SocketWrapperBase`
      Starts 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:
        `processSendfile` in class `SocketWrapperBase<java.lang.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:
        `populateRemoteAddr` in class `SocketWrapperBase<java.lang.Long>`

    - #### populateRemoteHost

          protected void populateRemoteHost()

      Specified by:
        `populateRemoteHost` in class `SocketWrapperBase<java.lang.Long>`

    - #### populateRemotePort

          protected void populateRemotePort()

      Specified by:
        `populateRemotePort` in class `SocketWrapperBase<java.lang.Long>`

    - #### populateLocalName

          protected void populateLocalName()

      Specified by:
        `populateLocalName` in class `SocketWrapperBase<java.lang.Long>`

    - #### populateLocalAddr

          protected void populateLocalAddr()

      Specified by:
        `populateLocalAddr` in class `SocketWrapperBase<java.lang.Long>`

    - #### populateLocalPort

          protected void populateLocalPort()

      Specified by:
        `populateLocalPort` in class `SocketWrapperBase<java.lang.Long>`

    - #### getSslSupport

          public SSLSupport getSslSupport​(java.lang.String clientCertProvider)

      Description copied from class: `SocketWrapperBase`
      Obtain an SSLSupport instance for this socket.
      Overrides:
        `getSslSupport` in class `SocketWrapperBase<java.lang.Long>`
      Parameters:
        `clientCertProvider` - The name of the client certificate provider to use. Only used by APR/native.
      Returns:
        An SSLSupport instance for this socket.

    - #### getSslSupport

          public SSLSupport getSslSupport()

      Description copied from class: `SocketWrapperBase`
      Obtain an SSLSupport instance for this socket.
      Specified by:
        `getSslSupport` in class `SocketWrapperBase<java.lang.Long>`
      Returns:
        An SSLSupport instance for this socket.

    - #### doClientAuth

          public void doClientAuth​(SSLSupport sslSupport)
                            throws java.io.IOException

      Description copied from class: `SocketWrapperBase`
      Require the client to perform CLIENT-CERT authentication if it hasn't already done so.
      Specified by:
        `doClientAuth` in class `SocketWrapperBase<java.lang.Long>`
      Parameters:
        `sslSupport` - The SSL/TLS support instance currently being used by the connection that may need updating after the client authentication
      Throws:
        `java.io.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:
        `setAppReadBufHandler` in class `SocketWrapperBase<java.lang.Long>`

    - #### newOperationState

          protected <A> SocketWrapperBase.OperationState<A> newOperationState​(boolean read,
                                                                              java.nio.ByteBuffer[] buffers,
                                                                              int offset,
                                                                              int length,
                                                                              SocketWrapperBase.BlockingMode block,
                                                                              long timeout,
                                                                              java.util.concurrent.TimeUnit unit,
                                                                              A attachment,
                                                                              SocketWrapperBase.CompletionCheck check,
                                                                              java.nio.channels.CompletionHandler<java.lang.Long,​? super A> handler,
                                                                              java.util.concurrent.Semaphore semaphore,
                                                                              SocketWrapperBase.VectoredIOCompletionHandler<A> completion)

      Specified by:
        `newOperationState` in class `SocketWrapperBase<java.lang.Long>`