Class HttpChannelOverHttp

    • Method Detail

      • abort

        public void abort​(java.lang.Throwable failure)
        Description copied from class: HttpChannel
        If a write or similar operation to this channel fails, then this method should be called.

        The standard implementation calls HttpTransport.abort(Throwable).

        Overrides:
        abort in class HttpChannel
        Parameters:
        failure - the failure that caused the abort.
      • produceContent

        public HttpInput.Content produceContent()
        Description copied from class: HttpChannel
        Produce a HttpInput.Content object with data currently stored within the channel. The produced content can be special (meaning calling HttpInput.Content.isSpecial() returns true) if the channel reached a special state, like EOF or an error. Once a special content has been returned, all subsequent calls to this method will always return a special content of the same kind and HttpChannel.needContent() will always return true. The returned content is "raw", i.e.: not decoded.
        Specified by:
        produceContent in class HttpChannel
        Returns:
        a HttpInput.Content object if one is immediately available without blocking, null otherwise.
      • failAllContent

        public boolean failAllContent​(java.lang.Throwable failure)
        Description copied from class: HttpChannel
        Fail all content that is currently stored within the channel.
        Specified by:
        failAllContent in class HttpChannel
        Parameters:
        failure - the failure to fail the content with.
        Returns:
        true if EOF was reached while failing all content, false otherwise.
      • continue100

        public void continue100​(int available)
                         throws java.io.IOException
        If the associated response has the Expect header set to 100 Continue, then accessing the input stream indicates that the handler/servlet is ready for the request body and thus a 100 Continue response is sent.
        Overrides:
        continue100 in class HttpChannel
        Parameters:
        available - estimate of the number of bytes that are available
        Throws:
        java.io.IOException - if the InputStream cannot be created
      • eof

        protected boolean eof()
        Description copied from class: HttpChannel
        Mark the channel's input as EOF.
        Specified by:
        eof in class HttpChannel
        Returns:
        true if the channel needs to be rescheduled.
      • failed

        public boolean failed​(java.lang.Throwable x)
        Description copied from class: HttpChannel
        Fail the channel's input.
        Specified by:
        failed in class HttpChannel
        Parameters:
        x - the failure.
        Returns:
        true if the channel needs to be rescheduled.
      • servletUpgrade

        public void servletUpgrade()
      • startRequest

        public void startRequest​(java.lang.String method,
                                 java.lang.String uri,
                                 HttpVersion version)
        Description copied from interface: HttpParser.RequestHandler
        This is the method called by parser when the HTTP request line is parsed
        Specified by:
        startRequest in interface HttpParser.RequestHandler
        Parameters:
        method - The method
        uri - The raw bytes of the URI. These are copied into a ByteBuffer that will not be changed until this parser is reset and reused.
        version - the http version in use
      • checkAndPrepareUpgrade

        protected boolean checkAndPrepareUpgrade()
        Description copied from class: HttpChannel

        Checks whether the processing of the request resulted in an upgrade, and if so performs upgrade preparation steps before the upgrade response is sent back to the client.

        This avoids a race where the server is unprepared if the client sends data immediately after having received the upgrade response.

        Overrides:
        checkAndPrepareUpgrade in class HttpChannel
        Returns:
        true if the channel is not complete and more processing is required, typically because sendError has been called.
      • handleException

        protected void handleException​(java.lang.Throwable x)
        Description copied from class: HttpChannel

        Sends an error 500, performing a special logic to detect whether the request is suspended, to avoid concurrent writes from the application.

        It may happen that the application suspends, and then throws an exception, while an application spawned thread writes the response content; in such case, we attempt to commit the error directly bypassing the ErrorHandler mechanisms and the response OutputStream.

        Overrides:
        handleException in class HttpChannel
        Parameters:
        x - the Throwable that caused the problem