Class NHttpConnectionBase

    • Method Detail

      • getHttpRequest

        public HttpRequest getHttpRequest()
        Description copied from interface: NHttpConnection
        Returns the current HTTP request if one is being received / transmitted. Otherwise returns null.
        Specified by:
        getHttpRequest in interface NHttpConnection
        Returns:
        HTTP request, if available, null otherwise.
      • getHttpResponse

        public HttpResponse getHttpResponse()
        Description copied from interface: NHttpConnection
        Returns the current HTTP response if one is being received / transmitted. Otherwise returns null.
        Specified by:
        getHttpResponse in interface NHttpConnection
        Returns:
        HTTP response, if available, null otherwise.
      • requestInput

        public void requestInput()
        Description copied from interface: IOControl
        Requests event notifications to be triggered when the underlying channel is ready for input operations.
        Specified by:
        requestInput in interface IOControl
      • requestOutput

        public void requestOutput()
        Description copied from interface: IOControl
        Requests event notifications to be triggered when the underlying channel is ready for output operations.
        Specified by:
        requestOutput in interface IOControl
      • suspendInput

        public void suspendInput()
        Description copied from interface: IOControl
        Suspends event notifications about the underlying channel being ready for input operations.
        Specified by:
        suspendInput in interface IOControl
      • suspendOutput

        public void suspendOutput()
        Description copied from interface: IOControl
        Suspends event notifications about the underlying channel being ready for output operations.
        Specified by:
        suspendOutput in interface IOControl
      • hasBufferedInput

        public boolean hasBufferedInput()
        Description copied from interface: SessionBufferStatus
        Determines if the session input buffer contains data.
        Specified by:
        hasBufferedInput in interface SessionBufferStatus
        Returns:
        true if the session input buffer contains data, false otherwise.
      • hasBufferedOutput

        public boolean hasBufferedOutput()
        Description copied from interface: SessionBufferStatus
        Determines if the session output buffer contains data.
        Specified by:
        hasBufferedOutput in interface SessionBufferStatus
        Returns:
        true if the session output buffer contains data, false otherwise.
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: HttpConnection
        Closes 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. Use shutdown instead.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface HttpConnection
        Throws:
        java.io.IOException
      • isOpen

        public boolean isOpen()
        Description copied from interface: HttpConnection
        Checks if this connection is open.
        Specified by:
        isOpen in interface HttpConnection
        Returns:
        true if it is open, false if it is closed.
      • isStale

        public boolean isStale()
        Description copied from interface: HttpConnection
        Checks whether this connection has gone down. Network connections may get closed during some time of inactivity for several reasons. The next time a read is attempted on such a connection it will throw an IOException. This method tries to alleviate this inconvenience by trying to find out if a connection is still usable. Implementations may do that by attempting a read with a very small timeout. Thus this method may block for a small amount of time before returning a result. It is therefore an expensive operation.
        Specified by:
        isStale in interface HttpConnection
        Returns:
        true if attempts to use this connection are likely to succeed, or false if they are likely to fail and this connection should be closed
      • setSocketTimeout

        public void setSocketTimeout​(int timeout)
        Description copied from interface: HttpConnection
        Sets the socket timeout value.
        Specified by:
        setSocketTimeout in interface HttpConnection
        Parameters:
        timeout - timeout value in milliseconds
      • getSocketTimeout

        public int getSocketTimeout()
        Description copied from interface: HttpConnection
        Returns the socket timeout value.
        Specified by:
        getSocketTimeout in interface HttpConnection
        Returns:
        positive value in milliseconds if a timeout is set, 0 if timeout is disabled or -1 if timeout is undefined.
      • shutdown

        public void shutdown()
                      throws java.io.IOException
        Description copied from interface: HttpConnection
        Force-closes this connection. This is the only method of a connection which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.
        Specified by:
        shutdown in interface HttpConnection
        Specified by:
        shutdown in interface IOControl
        Throws:
        java.io.IOException - in an error occurs
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getSocket

        public java.net.Socket getSocket()
        Description copied from interface: SocketAccessor
        Return the underlying socket
        Specified by:
        getSocket in interface SocketAccessor
        Returns:
        - the underlying Socket, may be null.