Package org.apache.synapse.transport.passthru

## Class DefaultStreamInterceptor

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

- All Implemented Interfaces:
    `StreamInterceptor`
  Direct Known Subclasses:
    `LoggingStreamInterceptor`

      public abstract class DefaultStreamInterceptor
      extends Object
      implements StreamInterceptor

  Default class implementing the methods of `StreamInterceptor`. A stream interceptor can be written by extending and overding the necessary methods of this class. For an example see`LoggingStreamInterceptor`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultStreamInterceptor()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addProperty​(String name, Object value)` | Add an interceptor property
    `Map` | `getProperties()` | Get all interceptor properties
    `boolean` | `interceptSourceRequest​(org.apache.axis2.context.MessageContext axisCtx)` | Logic to determine whether to intercept the source request
    `boolean` | `interceptSourceResponse​(org.apache.axis2.context.MessageContext axisCtx)` | Logic to determine whether to intercept the source response
    `boolean` | `interceptTargetRequest​(org.apache.axis2.context.MessageContext axisCtx)` | Logic to determine whether to intercept the target request
    `boolean` | `interceptTargetResponse​(org.apache.axis2.context.MessageContext axisCtx)` | Logic to determine whether to intercept the target response
    `boolean` | `sourceRequest​(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)` | Handles the request data coming in to the engine from the client
    `void` | `sourceResponse​(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)` | Handles the response data leaving out of the engine
    `void` | `targetRequest​(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)` | Handles the request data leaving out of the engine
    `boolean` | `targetResponse​(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)` | Handles the response data coming in to the engine from the back end

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

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

- - ### Constructor Detail

    - #### DefaultStreamInterceptor

          public DefaultStreamInterceptor()

  - ### Method Detail

    - #### interceptSourceRequest

          public boolean interceptSourceRequest​(org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Logic to determine whether to intercept the source request
      Specified by:
        `interceptSourceRequest` in interface `StreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the request
      Returns:
        intercept source request or not

    - #### sourceRequest

          public boolean sourceRequest​(ByteBuffer buffer,
                                       org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Handles the request data coming in to the engine from the client
      Specified by:
        `sourceRequest` in interface `StreamInterceptor`
      Parameters:
        `buffer` - copy of data entering in
        `axisCtx` - associated axis2MsgCtx
      Returns:
        whether to continue reading the data or to close the connection

    - #### interceptTargetRequest

          public boolean interceptTargetRequest​(org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Logic to determine whether to intercept the target request
      Specified by:
        `interceptTargetRequest` in interface `StreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the request
      Returns:
        intercept target request or not

    - #### targetRequest

          public void targetRequest​(ByteBuffer buffer,
                                    org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Handles the request data leaving out of the engine
      Specified by:
        `targetRequest` in interface `StreamInterceptor`
      Parameters:
        `buffer` - copy of data being send out
        `axisCtx` - associated axis2MsgCtx

    - #### interceptTargetResponse

          public boolean interceptTargetResponse​(org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Logic to determine whether to intercept the target response
      Specified by:
        `interceptTargetResponse` in interface `StreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the response
      Returns:
        intercept target response or not

    - #### targetResponse

          public boolean targetResponse​(ByteBuffer buffer,
                                        org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Handles the response data coming in to the engine from the back end
      Specified by:
        `targetResponse` in interface `StreamInterceptor`
      Parameters:
        `buffer` - copy of data entering in
        `axisCtx` - associated axis2MsgCtx
      Returns:
        whether to continue reading the data or to close the connection

    - #### interceptSourceResponse

          public boolean interceptSourceResponse​(org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Logic to determine whether to intercept the source response
      Specified by:
        `interceptSourceResponse` in interface `StreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the response
      Returns:
        intercept source response or not

    - #### sourceResponse

          public void sourceResponse​(ByteBuffer buffer,
                                     org.apache.axis2.context.MessageContext axisCtx)

      Description copied from interface: `StreamInterceptor`
      Handles the response data leaving out of the engine
      Specified by:
        `sourceResponse` in interface `StreamInterceptor`
      Parameters:
        `buffer` - copy of data leaving
        `axisCtx` - associated axis2MsgCtx

    - #### addProperty

          public void addProperty​(String name,
                                  Object value)

      Description copied from interface: `StreamInterceptor`
      Add an interceptor property
      Specified by:
        `addProperty` in interface `StreamInterceptor`
      Parameters:
        `name` - property name
        `value` - property value

    - #### getProperties

          public Map getProperties()

      Description copied from interface: `StreamInterceptor`
      Get all interceptor properties
      Specified by:
        `getProperties` in interface `StreamInterceptor`
      Returns:
        Map of handler properties