Package org.apache.synapse.transport.passthru

# Interface StreamInterceptor

All Known Implementing Classes:
  `DefaultStreamInterceptor`, `LoggingStreamInterceptor`

public interface StreamInterceptor
Interface For Stream Interceptors

Interceptors are invoked when the data is received to the synapse engine or when data is sent out of the engine.

After a connection is established, the data is read chunk wise/ whenever available. The same applies when the data leaves the engine as well. There are two requests coming into the engine and two responses going out from the engine. Interceptors will be invoked in all of these four phases

- ## Method Summary

  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

- ## Method Details

  - ### interceptSourceRequest

    boolean interceptSourceRequest(org.apache.axis2.context.MessageContext axisCtx)
    Logic to determine whether to intercept the source request
    Parameters:
      `axisCtx` - associated axis2MsgCtx of the request
    Returns:
      intercept source request or not

  - ### sourceRequest

    boolean sourceRequest(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)
    Handles the request data coming in to the engine from the client
    Parameters:
      `buffer` - copy of data entering in
      `axisCtx` - associated axis2MsgCtx
    Returns:
      whether to continue reading the data or to close the connection

  - ### interceptTargetRequest

    boolean interceptTargetRequest(org.apache.axis2.context.MessageContext axisCtx)
    Logic to determine whether to intercept the target request
    Parameters:
      `axisCtx` - associated axis2MsgCtx of the request
    Returns:
      intercept target request or not

  - ### targetRequest

    void targetRequest(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)
    Handles the request data leaving out of the engine
    Parameters:
      `buffer` - copy of data being send out
      `axisCtx` - associated axis2MsgCtx

  - ### interceptTargetResponse

    boolean interceptTargetResponse(org.apache.axis2.context.MessageContext axisCtx)
    Logic to determine whether to intercept the target response
    Parameters:
      `axisCtx` - associated axis2MsgCtx of the response
    Returns:
      intercept target response or not

  - ### targetResponse

    boolean targetResponse(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)
    Handles the response data coming in to the engine from the back end
    Parameters:
      `buffer` - copy of data entering in
      `axisCtx` - associated axis2MsgCtx
    Returns:
      whether to continue reading the data or to close the connection

  - ### interceptSourceResponse

    boolean interceptSourceResponse(org.apache.axis2.context.MessageContext axisCtx)
    Logic to determine whether to intercept the source response
    Parameters:
      `axisCtx` - associated axis2MsgCtx of the response
    Returns:
      intercept source response or not

  - ### sourceResponse

    void sourceResponse(ByteBuffer buffer, org.apache.axis2.context.MessageContext axisCtx)
    Handles the response data leaving out of the engine
    Parameters:
      `buffer` - copy of data leaving
      `axisCtx` - associated axis2MsgCtx

  - ### addProperty

    void addProperty(String name, Object value)
    Add an interceptor property
    Parameters:
      `name` - property name
      `value` - property value

  - ### getProperties

    Map getProperties()
    Get all interceptor properties
    Returns:
      Map of handler properties