org.apache.synapse.transport.passthru.util

## Class PassThroughTransportUtils

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

-     public class PassThroughTransportUtils
      extends Object

  Utility methods used by the transport.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PassThroughTransportUtils()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `determineHttpStatusCode(org.apache.axis2.context.MessageContext msgContext)` Determine the Http Status Code depending on the message type processed (normal response versus fault response) as well as Axis2 message context properties set via Synapse configuration or MessageBuilders.
    `static String` | `determineHttpStatusLine(org.apache.axis2.context.MessageContext msgContext)` Determine the Http Status Message depending on the message type processed (normal response versus fault response) as well as Axis2 message context properties set via Synapse configuration or MessageBuilders.
    `static org.apache.axis2.addressing.EndpointReference` | `getDestinationEPR(org.apache.axis2.context.MessageContext msgContext)` Get the EPR for the message passed in
    `static String` | `getHostName(InetAddress address)` This method tries to determine the hostname of the given InetAddress without triggering a reverse DNS lookup.
    `static String` | `getIpAddress()` Whatever this method returns as the IP is ignored by the actual http/s listener when its getServiceEPR is invoked.
    `static org.apache.axiom.om.OMOutputFormat` | `getOMOutputFormat(org.apache.axis2.context.MessageContext msgContext)`
    `String` | `getServicesHTML(String prefix, org.apache.axis2.context.ConfigurationContext cfgCtx)` Returns the HTML text for the list of services deployed.
    `static void` | `removeUnwantedHeaders(org.apache.axis2.context.MessageContext msgContext, TargetConfiguration targetConfiguration)` Remove unwanted headers from the http response of outgoing request.

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

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

- - ### Constructor Detail

    - #### PassThroughTransportUtils

          public PassThroughTransportUtils()

  - ### Method Detail

    - #### getHostName

          public static String getHostName(InetAddress address)

      This method tries to determine the hostname of the given InetAddress without triggering a reverse DNS lookup. `InetAddress.getHostName()` triggers a reverse DNS lookup which can be very costly in cases where reverse DNS fails. Tries to parse a symbolic hostname from `InetAddress.toString()`, which is documented to return a String of the form "hostname / literal IP address" with 'hostname' blank if not already computed & stored in `address`.

      If the hostname cannot be determined from InetAddress.toString(), the value of `InetAddress.getHostAddress()` is returned.
      Parameters:
        `address` - The InetAddress whose hostname has to be determined
      Returns:
        hostsname, if it can be determined. hostaddress, if not.

    - #### getDestinationEPR

          public static org.apache.axis2.addressing.EndpointReference getDestinationEPR(org.apache.axis2.context.MessageContext msgContext)

      Get the EPR for the message passed in
      Parameters:
        `msgContext` - the message context
      Returns:
        the destination EPR

    - #### removeUnwantedHeaders

          public static void removeUnwantedHeaders(org.apache.axis2.context.MessageContext msgContext,
                                                   TargetConfiguration targetConfiguration)

      Remove unwanted headers from the http response of outgoing request. These are headers which should be dictated by the transport and not the user. We remove these as these may get copied from the request messages
      Parameters:
        `msgContext` - the Axis2 Message context from which these headers should be removed
        `targetConfiguration` - configuration for the passThrough handler

    - #### determineHttpStatusCode

          public static int determineHttpStatusCode(org.apache.axis2.context.MessageContext msgContext)

      Determine the Http Status Code depending on the message type processed
      (normal response versus fault response) as well as Axis2 message context properties set via Synapse configuration or MessageBuilders.
      Parameters:
        `msgContext` - the Axis2 message context
      Returns:
        the HTTP status code to set in the HTTP response object
      See Also:
        `PassThroughConstants.FAULTS_AS_HTTP_200`, `PassThroughConstants.HTTP_SC`

    - #### determineHttpStatusLine

          public static String determineHttpStatusLine(org.apache.axis2.context.MessageContext msgContext)

      Determine the Http Status Message depending on the message type processed
      (normal response versus fault response) as well as Axis2 message context properties set via Synapse configuration or MessageBuilders.
      Parameters:
        `msgContext` - the Axis2 message context
      Returns:
        the HTTP status message string or null
      See Also:
        `PassThroughConstants.FAULTS_AS_HTTP_200`, `PassThroughConstants.HTTP_SC`

    - #### getIpAddress

          public static String getIpAddress()
                                     throws SocketException

      Whatever this method returns as the IP is ignored by the actual http/s listener when its getServiceEPR is invoked. This was originally copied from axis2
      Returns:
        Returns String.
      Throws:
        `SocketException` - if the socket can not be accessed

    - #### getServicesHTML

          public String getServicesHTML(String prefix,
                                        org.apache.axis2.context.ConfigurationContext cfgCtx)

      Returns the HTML text for the list of services deployed. This can be delegated to another Class as well where it will handle more options of GET messages.
      Parameters:
        `prefix` - to be used for the Service names
        `cfgCtx` - axis2 configuration context
      Returns:
        the HTML to be displayed as a String

    - #### getOMOutputFormat

          public static org.apache.axiom.om.OMOutputFormat getOMOutputFormat(org.apache.axis2.context.MessageContext msgContext)

Copyright © 2005–2017 Apache Software Foundation. All rights reserved.