Class AbstractServerConnection

  • All Implemented Interfaces:
    Attachable, java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, java.nio.channels.InterruptibleChannel, org.xnio.channels.BoundChannel, org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, org.xnio.channels.ConnectedChannel
    Direct Known Subclasses:
    AjpServerConnection, HttpServerConnection

    public abstract class AbstractServerConnection
    extends ServerConnection
    • Field Detail

      • channel

        protected final org.xnio.StreamConnection channel
      • closeSetter

        protected final io.undertow.server.AbstractServerConnection.CloseSetter closeSetter
      • undertowOptions

        protected final org.xnio.OptionMap undertowOptions
      • originalSourceConduit

        protected final org.xnio.conduits.StreamSourceConduit originalSourceConduit
      • originalSinkConduit

        protected final org.xnio.conduits.StreamSinkConduit originalSinkConduit
      • extraBytes

        protected PooledByteBuffer extraBytes
        Any extra bytes that were read from the channel. This could be data for this requests, or the next response.
    • Constructor Detail

      • AbstractServerConnection

        public AbstractServerConnection​(org.xnio.StreamConnection channel,
                                        ByteBufferPool bufferPool,
                                        HttpHandler rootHandler,
                                        org.xnio.OptionMap undertowOptions,
                                        int bufferSize)
    • Method Detail

      • getBufferPool

        public org.xnio.Pool<java.nio.ByteBuffer> getBufferPool()
        Specified by:
        getBufferPool in class ServerConnection
        Returns:
        The connections buffer pool
      • getRootHandler

        public HttpHandler getRootHandler()
        Get the root HTTP handler for this connection.
        Returns:
        the root HTTP handler for this connection
      • getChannel

        public org.xnio.StreamConnection getChannel()
        Get the underlying channel.
        Returns:
        the underlying channel
      • getCloseSetter

        public org.xnio.ChannelListener.Setter<ServerConnection> getCloseSetter()
      • getWorker

        public org.xnio.XnioWorker getWorker()
        Specified by:
        getWorker in interface org.xnio.channels.CloseableChannel
        Specified by:
        getWorker in class ServerConnection
        Returns:
        The connections worker
      • getIoThread

        public org.xnio.XnioIoThread getIoThread()
        Specified by:
        getIoThread in interface org.xnio.channels.CloseableChannel
        Specified by:
        getIoThread in class ServerConnection
        Returns:
        The IO thread associated with the connection
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
        Specified by:
        isOpen in class ServerConnection
        Returns:
        true if the connection is open
      • supportsOption

        public boolean supportsOption​(org.xnio.Option<?> option)
        Specified by:
        supportsOption in interface org.xnio.channels.Configurable
        Specified by:
        supportsOption in class ServerConnection
      • getOption

        public <T> T getOption​(org.xnio.Option<T> option)
                        throws java.io.IOException
        Specified by:
        getOption in interface org.xnio.channels.Configurable
        Specified by:
        getOption in class ServerConnection
        Throws:
        java.io.IOException
      • setOption

        public <T> T setOption​(org.xnio.Option<T> option,
                               T value)
                        throws java.lang.IllegalArgumentException,
                               java.io.IOException
        Specified by:
        setOption in interface org.xnio.channels.Configurable
        Specified by:
        setOption in class ServerConnection
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.xnio.channels.CloseableChannel
        Specified by:
        close in interface java.nio.channels.InterruptibleChannel
        Specified by:
        close in class ServerConnection
        Throws:
        java.io.IOException
      • getPeerAddress

        public java.net.SocketAddress getPeerAddress()
        Description copied from class: ServerConnection
        Returns the actual address of the remote connection. This will not take things like X-Forwarded-for into account.
        Specified by:
        getPeerAddress in interface org.xnio.channels.ConnectedChannel
        Specified by:
        getPeerAddress in class ServerConnection
        Returns:
        The address of the remote peer
      • getPeerAddress

        public <A extends java.net.SocketAddress> A getPeerAddress​(java.lang.Class<A> type)
        Description copied from class: ServerConnection
        Returns the actual address of the remote connection. This will not take things like X-Forwarded-for into account.
        Specified by:
        getPeerAddress in interface org.xnio.channels.ConnectedChannel
        Specified by:
        getPeerAddress in class ServerConnection
        Type Parameters:
        A - The address type
        Parameters:
        type - The type of address to return
        Returns:
        The remote endpoint address
      • getLocalAddress

        public java.net.SocketAddress getLocalAddress()
        Specified by:
        getLocalAddress in interface org.xnio.channels.BoundChannel
        Specified by:
        getLocalAddress in class ServerConnection
      • getLocalAddress

        public <A extends java.net.SocketAddress> A getLocalAddress​(java.lang.Class<A> type)
        Specified by:
        getLocalAddress in interface org.xnio.channels.BoundChannel
        Specified by:
        getLocalAddress in class ServerConnection
      • getBufferSize

        public int getBufferSize()
        Specified by:
        getBufferSize in class ServerConnection
        Returns:
        The size of the buffers allocated by the buffer pool
      • getOriginalSourceConduit

        public org.xnio.conduits.StreamSourceConduit getOriginalSourceConduit()
        Returns:
        The original source conduit
      • getOriginalSinkConduit

        public org.xnio.conduits.StreamSinkConduit getOriginalSinkConduit()
        Returns:
        The original underlying sink conduit
      • clearChannel

        public void clearChannel()
        Resets the channel to its original state, effectively disabling all current conduit wrappers. The current state is lost.