Package org.apache.synapse.transport.passthru

## Class LoggingStreamInterceptor

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

- All Implemented Interfaces:
    `StreamInterceptor`

      public class LoggingStreamInterceptor
      extends DefaultStreamInterceptor

  Sample stream interceptor, which intercepts source and target request to print the stream passing via the engine.

       <interceptors xmlns:svns="http://org.wso2.securevault/configuration">
           <interceptor class="org.apache.synapse.transport.passthru.LoggingStreamInterceptor">
               <parameter name="charset" value="ISO-8859-1"/>
               <parameter name="enableInterception" value="true"/>
           </interceptor>
       </interceptors>

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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
    `void` | `setCharset​(String charset)` |
    `void` | `setEnableInterception​(boolean enableInterception)` |
    `boolean` | `sourceRequest​(ByteBuffer buffer, org.apache.axis2.context.MessageContext ctx)` | Handles the request data coming in to the engine from the client
    `void` | `sourceResponse​(ByteBuffer buffer, org.apache.axis2.context.MessageContext ctx)` | Handles the response data leaving out of the engine
    `void` | `targetRequest​(ByteBuffer buffer, org.apache.axis2.context.MessageContext ctx)` | Handles the request data leaving out of the engine
    `boolean` | `targetResponse​(ByteBuffer buffer, org.apache.axis2.context.MessageContext ctx)` | Handles the response data coming in to the engine from the back end

    - ### Methods inherited from class org.apache.synapse.transport.passthru.DefaultStreamInterceptor

      `addProperty, getProperties`

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

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

- - ### Constructor Detail

    - #### LoggingStreamInterceptor

          public LoggingStreamInterceptor()

  - ### 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`
      Overrides:
        `interceptSourceRequest` in class `DefaultStreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the request
      Returns:
        intercept source request or not

    - #### sourceRequest

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

      Description copied from interface: `StreamInterceptor`
      Handles the request data coming in to the engine from the client
      Specified by:
        `sourceRequest` in interface `StreamInterceptor`
      Overrides:
        `sourceRequest` in class `DefaultStreamInterceptor`
      Parameters:
        `buffer` - copy of data entering in
        `ctx` - 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`
      Overrides:
        `interceptTargetRequest` in class `DefaultStreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the request
      Returns:
        intercept target request or not

    - #### targetRequest

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

      Description copied from interface: `StreamInterceptor`
      Handles the request data leaving out of the engine
      Specified by:
        `targetRequest` in interface `StreamInterceptor`
      Overrides:
        `targetRequest` in class `DefaultStreamInterceptor`
      Parameters:
        `buffer` - copy of data being send out
        `ctx` - 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`
      Overrides:
        `interceptTargetResponse` in class `DefaultStreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the response
      Returns:
        intercept target response or not

    - #### targetResponse

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

      Description copied from interface: `StreamInterceptor`
      Handles the response data coming in to the engine from the back end
      Specified by:
        `targetResponse` in interface `StreamInterceptor`
      Overrides:
        `targetResponse` in class `DefaultStreamInterceptor`
      Parameters:
        `buffer` - copy of data entering in
        `ctx` - 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`
      Overrides:
        `interceptSourceResponse` in class `DefaultStreamInterceptor`
      Parameters:
        `axisCtx` - associated axis2MsgCtx of the response
      Returns:
        intercept source response or not

    - #### sourceResponse

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

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

    - #### setCharset

          public void setCharset​(String charset)

    - #### setEnableInterception

          public void setEnableInterception​(boolean enableInterception)