Class SourceHandler

  • All Implemented Interfaces:
    org.apache.http.nio.NHttpServerEventHandler

    public class SourceHandler
    extends Object
    implements org.apache.http.nio.NHttpServerEventHandler
    This is the class where transport interacts with the client. This class receives events for a particular connection. These events give information about the message and its various states.
    • Method Detail

      • connected

        public void connected​(org.apache.http.nio.NHttpServerConnection conn)
        Specified by:
        connected in interface org.apache.http.nio.NHttpServerEventHandler
      • requestReceived

        public void requestReceived​(org.apache.http.nio.NHttpServerConnection conn)
        Specified by:
        requestReceived in interface org.apache.http.nio.NHttpServerEventHandler
      • setCorrelationId

        public void setCorrelationId​(org.apache.http.nio.NHttpServerConnection conn)
      • inputReady

        public void inputReady​(org.apache.http.nio.NHttpServerConnection conn,
                               org.apache.http.nio.ContentDecoder decoder)
        Specified by:
        inputReady in interface org.apache.http.nio.NHttpServerEventHandler
      • responseReady

        public void responseReady​(org.apache.http.nio.NHttpServerConnection conn)
        Specified by:
        responseReady in interface org.apache.http.nio.NHttpServerEventHandler
      • outputReady

        public void outputReady​(org.apache.http.nio.NHttpServerConnection conn,
                                org.apache.http.nio.ContentEncoder encoder)
        Specified by:
        outputReady in interface org.apache.http.nio.NHttpServerEventHandler
      • logIOException

        public void logIOException​(org.apache.http.nio.NHttpServerConnection conn,
                                   IOException e)
      • timeout

        public void timeout​(org.apache.http.nio.NHttpServerConnection conn)
        Specified by:
        timeout in interface org.apache.http.nio.NHttpServerEventHandler
      • closed

        public void closed​(org.apache.http.nio.NHttpServerConnection conn)
        Specified by:
        closed in interface org.apache.http.nio.NHttpServerEventHandler
      • endOfInput

        public void endOfInput​(org.apache.http.nio.NHttpServerConnection conn)
                        throws IOException
        Specified by:
        endOfInput in interface org.apache.http.nio.NHttpServerEventHandler
        Throws:
        IOException
      • exception

        public void exception​(org.apache.http.nio.NHttpServerConnection conn,
                              Exception ex)
        Specified by:
        exception in interface org.apache.http.nio.NHttpServerEventHandler
      • informReaderError

        public void informReaderError​(org.apache.http.nio.NHttpServerConnection conn)
      • informWriterError

        public void informWriterError​(org.apache.http.nio.NHttpServerConnection conn)
      • commitResponseHideExceptions

        public void commitResponseHideExceptions​(org.apache.http.nio.NHttpServerConnection conn,
                                                 org.apache.http.HttpResponse response)
        Commit the response to the connection. Processes the response through the configured HttpProcessor and submits it to be sent out. This method hides any exceptions and is targetted for non critical (i.e. browser requests etc) requests, which are not core messages
        Parameters:
        conn - the connection being processed
        response - the response to commit over the connection
      • stop

        public void stop()
        Shutting down the thread pools.
      • getOutputStream

        public OutputStream getOutputStream​(String method,
                                            SourceRequest request)
        Create synapse.response-source-buffer for GET and HEAD Http methods
        Parameters:
        method - Http Method
        request - Source Request
        Returns:
        OutputStream
      • getSourceRequest

        public SourceRequest getSourceRequest​(org.apache.http.nio.NHttpServerConnection conn)
                                       throws IOException,
                                              org.apache.http.HttpException
        Create SourceRequest from NHttpServerConnection conn
        Parameters:
        conn - the connection being processed
        Returns:
        SourceRequest
        Throws:
        IOException
        org.apache.http.HttpException