Package org.apache.synapse.transport.passthru

## Class SourceContext

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

-     public class SourceContext
      extends Object

  This class represents the information about a TCP Connection at a given point in time. In a Single TCP Connection there can be multiple HTTP Requests.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `CONNECTION_INFORMATION` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SourceContext​(SourceConfiguration sourceConfiguration)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static boolean` | `assertState​(org.apache.http.nio.NHttpConnection conn, ProtocolState state)` |
    `static void` | `create​(org.apache.http.nio.NHttpConnection conn, ProtocolState state, SourceConfiguration configuration)` |
    `static SourceContext` | `get​(org.apache.http.nio.NHttpConnection conn)` |
    `long` | `getLastStateUpdatedTime()` |
    `Lock` | `getLock()` |
    `static Lock` | `getLock​(org.apache.http.nio.NHttpConnection conn)` |
    `Pipe` | `getReader()` |
    `SourceRequest` | `getRequest()` |
    `static SourceRequest` | `getRequest​(org.apache.http.nio.NHttpConnection conn)` |
    `SourceResponse` | `getResponse()` |
    `static SourceResponse` | `getResponse​(org.apache.http.nio.NHttpConnection conn)` |
    `SourceConfiguration` | `getSourceConfiguration()` |
    `ProtocolState` | `getState()` |
    `static ProtocolState` | `getState​(org.apache.http.nio.NHttpConnection conn)` |
    `Pipe` | `getWriter()` |
    `boolean` | `isShutDown()` |
    `boolean` | `isSourceRequestMarkedToBeDiscarded()` |
    `void` | `reset()` | Reset the resources associated with this context
    `void` | `reset​(boolean isError)` | Reset the resources associated with this context
    `void` | `setIsSourceRequestMarkedToBeDiscarded​(boolean isPipeDiscarded)` |
    `void` | `setReader​(Pipe reader)` |
    `static void` | `setRequest​(org.apache.http.nio.NHttpConnection conn, SourceRequest request)` |
    `void` | `setRequest​(SourceRequest request)` |
    `static void` | `setResponse​(org.apache.http.nio.NHttpConnection conn, SourceResponse response)` |
    `void` | `setResponse​(SourceResponse response)` |
    `void` | `setShutDown​(boolean shutDown)` |
    `void` | `setState​(ProtocolState state)` |
    `void` | `setWriter​(Pipe writer)` |
    `long` | `updateLastStateUpdatedTime()` |
    `static void` | `updateState​(org.apache.http.nio.NHttpConnection conn, ProtocolState state)` |

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

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

- - ### Field Detail

    - #### CONNECTION_INFORMATION

          public static final String CONNECTION_INFORMATION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SourceContext

          public SourceContext​(SourceConfiguration sourceConfiguration)

  - ### Method Detail

    - #### getSourceConfiguration

          public SourceConfiguration getSourceConfiguration()

    - #### getState

          public ProtocolState getState()

    - #### isSourceRequestMarkedToBeDiscarded

          public boolean isSourceRequestMarkedToBeDiscarded()

    - #### setIsSourceRequestMarkedToBeDiscarded

          public void setIsSourceRequestMarkedToBeDiscarded​(boolean isPipeDiscarded)

    - #### setState

          public void setState​(ProtocolState state)

    - #### getRequest

          public SourceRequest getRequest()

    - #### setRequest

          public void setRequest​(SourceRequest request)

    - #### getResponse

          public SourceResponse getResponse()

    - #### setResponse

          public void setResponse​(SourceResponse response)

    - #### reset

          public void reset()

      Reset the resources associated with this context

    - #### reset

          public void reset​(boolean isError)

      Reset the resources associated with this context
      Parameters:
        `isError` - whether an error is causing this shutdown of the connection. It is very important to set this flag correctly. When an error causing the shutdown of the connections we should not release associated writer buffer to the pool as it might lead into situations like same buffer is getting released to both source and target buffer factories

    - #### getLock

          public Lock getLock()

    - #### isShutDown

          public boolean isShutDown()

    - #### setShutDown

          public void setShutDown​(boolean shutDown)

    - #### getReader

          public Pipe getReader()

    - #### setReader

          public void setReader​(Pipe reader)

    - #### getWriter

          public Pipe getWriter()

    - #### setWriter

          public void setWriter​(Pipe writer)

    - #### create

          public static void create​(org.apache.http.nio.NHttpConnection conn,
                                    ProtocolState state,
                                    SourceConfiguration configuration)

    - #### updateState

          public static void updateState​(org.apache.http.nio.NHttpConnection conn,
                                         ProtocolState state)

    - #### assertState

          public static boolean assertState​(org.apache.http.nio.NHttpConnection conn,
                                            ProtocolState state)

    - #### getState

          public static ProtocolState getState​(org.apache.http.nio.NHttpConnection conn)

    - #### setRequest

          public static void setRequest​(org.apache.http.nio.NHttpConnection conn,
                                        SourceRequest request)

    - #### setResponse

          public static void setResponse​(org.apache.http.nio.NHttpConnection conn,
                                         SourceResponse response)

    - #### getRequest

          public static SourceRequest getRequest​(org.apache.http.nio.NHttpConnection conn)

    - #### getResponse

          public static SourceResponse getResponse​(org.apache.http.nio.NHttpConnection conn)

    - #### get

          public static SourceContext get​(org.apache.http.nio.NHttpConnection conn)

    - #### getLock

          public static Lock getLock​(org.apache.http.nio.NHttpConnection conn)

    - #### getLastStateUpdatedTime

          public long getLastStateUpdatedTime()

    - #### updateLastStateUpdatedTime

          public long updateLastStateUpdatedTime()