Package org.apache.synapse.transport.passthru.util

## Class RelayUtils

- java.lang.Object
- - org.apache.synapse.transport.passthru.util.RelayUtils

-     public class RelayUtils
      extends Object

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `buildMessage​(org.apache.axis2.context.MessageContext msgCtx)` |
    `static void` | `buildMessage​(org.apache.axis2.context.MessageContext messageContext, boolean earlyBuild)` |
    `static void` | `buildMessage​(org.apache.axis2.context.MessageContext messageContext, boolean earlyBuild, InputStream in)` |
    `static void` | `consumeAndDiscardMessage​(org.apache.axis2.context.MessageContext msgContext)` | Deprecated. use `discardRequestMessage(MessageContext)` instead
    `static void` | `discardMessage​(org.apache.axis2.context.MessageContext msgContext)` | Consumes the data in pipe completely in the given message context and discard it
    `static void` | `discardRequestMessage​(org.apache.axis2.context.MessageContext msgContext)` | Consumes the data in pipe completely in the request message context and discard it
    `static void` | `discardSourceRequest​(org.apache.axis2.context.MessageContext msgContext)` | Allocate a new buffer for the response Also, set suspendInput() state on connection so that when inputReady state hits it won't go for handleInvalidState and mark the source connection to be closed
    `static String` | `getMIMEContentType​(String contentType)` | Get MIME content type out of content-type header
    `static boolean` | `isDeleteRequestWithoutPayload​(org.apache.axis2.context.MessageContext msgContext)` | Function to check whether the processing request (enclosed within MessageContext) is a DELETE request without entity body since we allow to have payload for DELETE requests, we treat same as POST.
    `static boolean` | `isEmptyPayloadStream​(InputStream inputStream)` | Function to check given inputstream is empty or not Used to check whether content of the payload input stream is empty or not
    `static boolean` | `shouldOverwriteContentType​(org.apache.axis2.context.MessageContext msgContext, TargetRequest request)` | Check whether the we should overwrite the content type for the outgoing request.

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

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

- - ### Constructor Detail

    - #### RelayUtils

          public RelayUtils()

  - ### Method Detail

    - #### buildMessage

          public static void buildMessage​(org.apache.axis2.context.MessageContext msgCtx)
                                   throws IOException,
                                          XMLStreamException

      Throws:
        `IOException`
        `XMLStreamException`

    - #### buildMessage

          public static void buildMessage​(org.apache.axis2.context.MessageContext messageContext,
                                          boolean earlyBuild)
                                   throws IOException,
                                          XMLStreamException

      Throws:
        `IOException`
        `XMLStreamException`

    - #### buildMessage

          public static void buildMessage​(org.apache.axis2.context.MessageContext messageContext,
                                          boolean earlyBuild,
                                          InputStream in)
                                   throws IOException,
                                          org.apache.axis2.AxisFault

      Throws:
        `IOException`
        `org.apache.axis2.AxisFault`

    - #### getMIMEContentType

          public static String getMIMEContentType​(String contentType)

      Get MIME content type out of content-type header
      Parameters:
        `contentType` - content type header value
      Returns:
        MIME content type

    - #### isDeleteRequestWithoutPayload

          public static boolean isDeleteRequestWithoutPayload​(org.apache.axis2.context.MessageContext msgContext)

      Function to check whether the processing request (enclosed within MessageContext) is a DELETE request without entity body since we allow to have payload for DELETE requests, we treat same as POST. Hence this function can be used to deviate DELETE requests without payloads
      Parameters:
        `msgContext` - MessageContext
      Returns:
        whether the request is a DELETE without payload

    - #### shouldOverwriteContentType

          public static boolean shouldOverwriteContentType​(org.apache.axis2.context.MessageContext msgContext,
                                                           TargetRequest request)

      Check whether the we should overwrite the content type for the outgoing request.
      Parameters:
        `msgContext` - MessageContext
      Returns:
        whether to overwrite the content type for the outgoing request

    - #### isEmptyPayloadStream

          public static boolean isEmptyPayloadStream​(InputStream inputStream)
                                              throws IOException

      Function to check given inputstream is empty or not Used to check whether content of the payload input stream is empty or not
      Parameters:
        `inputStream` - target inputstream
      Returns:
        true if it is a empty stream
      Throws:
        `IOException`

    - #### consumeAndDiscardMessage

          @Deprecated
          public static void consumeAndDiscardMessage​(org.apache.axis2.context.MessageContext msgContext)
                                               throws org.apache.axis2.AxisFault

      Deprecated.
      use `discardRequestMessage(MessageContext)` instead
      Consumes the data in pipe completely in the request message context and discard it
      Parameters:
        `msgContext` - Axis2 Message context which contains the data
      Throws:
        `org.apache.axis2.AxisFault` - AxisFault

    - #### discardMessage

          public static void discardMessage​(org.apache.axis2.context.MessageContext msgContext)
                                     throws org.apache.axis2.AxisFault

      Consumes the data in pipe completely in the given message context and discard it
      Parameters:
        `msgContext` - Axis2 Message context which contains the data
      Throws:
        `org.apache.axis2.AxisFault` - AxisFault

    - #### discardRequestMessage

          public static void discardRequestMessage​(org.apache.axis2.context.MessageContext msgContext)
                                            throws org.apache.axis2.AxisFault

      Consumes the data in pipe completely in the request message context and discard it
      Parameters:
        `msgContext` - Axis2 Message context which contains the data
      Throws:
        `org.apache.axis2.AxisFault` - AxisFault

    - #### discardSourceRequest

          public static void discardSourceRequest​(org.apache.axis2.context.MessageContext msgContext)
                                           throws org.apache.axis2.AxisFault

      Allocate a new buffer for the response Also, set suspendInput() state on connection so that when inputReady state hits it won't go for handleInvalidState and mark the source connection to be closed
      Parameters:
        `msgContext` - Axis2 Message context which contains the data
      Throws:
        `org.apache.axis2.AxisFault` - AxisFault