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 and Description
    `LoggingStreamInterceptor()`

  - ### Method Summary

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

    - #### setEnableInterception

          public void setEnableInterception(boolean enableInterception)

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