org.apache.synapse.transport.passthru

## Class SourceHandler

- java.lang.Object
- - org.apache.synapse.transport.passthru.SourceHandler

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

      public class SourceHandler
      extends java.lang.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.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `MESSAGE_SIZE_VALIDATION`
    `static java.lang.String` | `PROPERTY_FILE`
    `static java.lang.String` | `VALID_MAX_MESSAGE_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SourceHandler(SourceConfiguration sourceConfiguration)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closed(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `commitResponseHideExceptions(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.HttpResponse response)` Commit the response to the connection.
    `void` | `connected(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `endOfInput(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `exception(org.apache.http.nio.NHttpServerConnection conn, java.lang.Exception ex)`
    `java.io.OutputStream` | `getOutputStream(java.lang.String method, SourceRequest request)` Create synapse.response-source-buffer for GET and HEAD Http methods
    `SourceRequest` | `getSourceRequest(org.apache.http.nio.NHttpServerConnection conn)` Create SourceRequest from NHttpServerConnection conn
    `void` | `informReaderError(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `informWriterError(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `inputReady(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentDecoder decoder)`
    `void` | `logIOException(org.apache.http.nio.NHttpServerConnection conn, java.io.IOException e)`
    `void` | `outputReady(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder)`
    `void` | `requestReceived(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `responseReady(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `setCorrelationId(org.apache.http.nio.NHttpServerConnection conn)`
    `void` | `stop()` Shutting down the thread pools.
    `void` | `timeout(org.apache.http.nio.NHttpServerConnection conn)`

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

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

- - ### Field Detail

    - #### PROPERTY_FILE

          public static final java.lang.String PROPERTY_FILE

      See Also:
        Constant Field Values

    - #### MESSAGE_SIZE_VALIDATION

          public static final java.lang.String MESSAGE_SIZE_VALIDATION

      See Also:
        Constant Field Values

    - #### VALID_MAX_MESSAGE_SIZE

          public static final java.lang.String VALID_MAX_MESSAGE_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SourceHandler

          public SourceHandler(SourceConfiguration sourceConfiguration)

  - ### 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,
                                     java.io.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 java.io.IOException

      Specified by:
        `endOfInput` in interface `org.apache.http.nio.NHttpServerEventHandler`
      Throws:
        `java.io.IOException`

    - #### exception

          public void exception(org.apache.http.nio.NHttpServerConnection conn,
                                java.lang.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 java.io.OutputStream getOutputStream(java.lang.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 java.io.IOException,
                                                org.apache.http.HttpException

      Create SourceRequest from NHttpServerConnection conn
      Parameters:
        `conn` - the connection being processed
      Returns:
        SourceRequest
      Throws:
        `java.io.IOException`
        `org.apache.http.HttpException`

Copyright © 2005-2020 Apache Software Foundation. All Rights Reserved.