org.apache.synapse.transport.passthru

## Class TargetContext

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

-     public class TargetContext
      extends Object

  When a connection is created, an object of this class is stored in the Connection Context. It is used as a holder for information required during the life-cycle of this connection.

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TargetContext(TargetConfiguration targetConfiguration)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `assertState(org.apache.http.nio.NHttpConnection conn, ProtocolState state)`
    `static void` | `create(org.apache.http.nio.NHttpConnection conn, ProtocolState state, TargetConfiguration configuration)`
    `static TargetContext` | `get(org.apache.http.nio.NHttpConnection conn)`
    `Pipe` | `getReader()`
    `TargetRequest` | `getRequest()`
    `static TargetRequest` | `getRequest(org.apache.http.nio.NHttpConnection conn)`
    `org.apache.axis2.context.MessageContext` | `getRequestMsgCtx()`
    `TargetResponse` | `getResponse()`
    `static TargetResponse` | `getResponse(org.apache.http.nio.NHttpConnection conn)`
    `ProtocolState` | `getState()`
    `static ProtocolState` | `getState(org.apache.http.nio.NHttpConnection conn)`
    `Pipe` | `getWriter()`
    `void` | `reset()` Reset the resources associated with this context
    `void` | `reset(boolean isError)` Reset the resources associated with this context
    `void` | `setReader(Pipe reader)`
    `static void` | `setRequest(org.apache.http.nio.NHttpConnection conn, TargetRequest request)`
    `void` | `setRequest(TargetRequest request)`
    `void` | `setRequestMsgCtx(org.apache.axis2.context.MessageContext requestMsgCtx)`
    `static void` | `setResponse(org.apache.http.nio.NHttpConnection conn, TargetResponse response)`
    `void` | `setResponse(TargetResponse response)`
    `void` | `setState(ProtocolState state)`
    `void` | `setWriter(Pipe writer)`
    `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

    - #### TargetContext

          public TargetContext(TargetConfiguration targetConfiguration)

  - ### Method Detail

    - #### getState

          public ProtocolState getState()

    - #### setState

          public void setState(ProtocolState state)

    - #### getRequest

          public TargetRequest getRequest()

    - #### setRequest

          public void setRequest(TargetRequest request)

    - #### getResponse

          public TargetResponse getResponse()

    - #### setResponse

          public void setResponse(TargetResponse response)

    - #### getRequestMsgCtx

          public org.apache.axis2.context.MessageContext getRequestMsgCtx()

    - #### setRequestMsgCtx

          public void setRequestMsgCtx(org.apache.axis2.context.MessageContext requestMsgCtx)

    - #### getReader

          public Pipe getReader()

    - #### getWriter

          public Pipe getWriter()

    - #### setReader

          public void setReader(Pipe reader)

    - #### setWriter

          public void setWriter(Pipe writer)

    - #### 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

    - #### create

          public static void create(org.apache.http.nio.NHttpConnection conn,
                                    ProtocolState state,
                                    TargetConfiguration 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,
                                        TargetRequest request)

    - #### setResponse

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

    - #### getRequest

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

    - #### getResponse

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

    - #### get

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

Copyright © 2005–2018 Apache Software Foundation. All rights reserved.