org.apache.synapse.transport.nhttp.util

## Class RESTUtil

- java.lang.Object
- - org.apache.synapse.transport.nhttp.util.RESTUtil

-     public class RESTUtil
      extends Object

  This class provides a set of utility methods to manage the REST invocation calls going out from the nhttp transport in the HTTP GET method

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RESTUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `dispatchAndVerify(org.apache.axis2.context.MessageContext msgContext)`
    `static org.apache.axis2.description.AxisOperation` | `findOperation(org.apache.axis2.description.AxisService svc, org.apache.axis2.context.MessageContext mc)` Get the axis operation from the operation name used by the Synapse service (for message mediation).
    `static String` | `getURI(org.apache.axis2.context.MessageContext messageContext, String address)` This method will return the URI part for the GET HTTPRequest by converting the SOAP infoset to the URL-encoded GET format
    `static void` | `processGetAndDeleteRequest(org.apache.axis2.context.MessageContext msgContext, OutputStream out, String requestURI, org.apache.http.Header contentTypeHeader, String httpMethod, boolean dispatching)` Processes the HTTP GET / DELETE request and builds the SOAP info-set of the REST message
    `static void` | `processPOSTRequest(org.apache.axis2.context.MessageContext msgContext, InputStream is, OutputStream os, String requestURI, org.apache.http.Header contentTypeHeader, boolean dispatching)` Processes the HTTP POST request and builds the SOAP info-set of the REST message
    `static void` | `processPOSTRequest(org.apache.axis2.context.MessageContext msgContext, InputStream is, OutputStream os, String requestURI, String contentType, boolean dispatching)` Processes the HTTP POST request and builds the SOAP info-set of the REST message
    `static void` | `processURLRequest(org.apache.axis2.context.MessageContext msgContext, OutputStream out, String soapAction, String requestURI)` Processes the HTTP GET request and builds the SOAP info-set of the REST message

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

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

- - ### Constructor Detail

    - #### RESTUtil

          public RESTUtil()

  - ### Method Detail

    - #### getURI

          public static String getURI(org.apache.axis2.context.MessageContext messageContext,
                                      String address)
                               throws org.apache.axis2.AxisFault

      This method will return the URI part for the GET HTTPRequest by converting the SOAP infoset to the URL-encoded GET format
      Parameters:
        `messageContext` - - from which the SOAP infoset will be extracted to encode
        `address` - - address of the actual service
      Returns:
        uri - ERI of the GET request
      Throws:
        `org.apache.axis2.AxisFault` - - if the SOAP infoset cannot be converted in to the GET URL-encoded format

    - #### processGetAndDeleteRequest

          public static void processGetAndDeleteRequest(org.apache.axis2.context.MessageContext msgContext,
                                                        OutputStream out,
                                                        String requestURI,
                                                        org.apache.http.Header contentTypeHeader,
                                                        String httpMethod,
                                                        boolean dispatching)
                                                 throws org.apache.axis2.AxisFault

      Processes the HTTP GET / DELETE request and builds the SOAP info-set of the REST message
      Parameters:
        `msgContext` - The MessageContext of the Request Message
        `out` - The output stream of the response
        `requestURI` - The URL that the request came to
        `contentTypeHeader` - The contentType header of the request
        `httpMethod` - The http method of the request
        `dispatching` - Weather we should do service dispatching
      Throws:
        `org.apache.axis2.AxisFault` - - Thrown in case a fault occurs

    - #### processURLRequest

          public static void processURLRequest(org.apache.axis2.context.MessageContext msgContext,
                                               OutputStream out,
                                               String soapAction,
                                               String requestURI)
                                        throws org.apache.axis2.AxisFault

      Processes the HTTP GET request and builds the SOAP info-set of the REST message
      Parameters:
        `msgContext` - The MessageContext of the Request Message
        `out` - The output stream of the response
        `soapAction` - SoapAction of the request
        `requestURI` - The URL that the request came to
      Throws:
        `org.apache.axis2.AxisFault` - - Thrown in case a fault occurs

    - #### processPOSTRequest

          public static void processPOSTRequest(org.apache.axis2.context.MessageContext msgContext,
                                                InputStream is,
                                                OutputStream os,
                                                String requestURI,
                                                org.apache.http.Header contentTypeHeader,
                                                boolean dispatching)
                                         throws org.apache.axis2.AxisFault

      Processes the HTTP POST request and builds the SOAP info-set of the REST message
      Parameters:
        `msgContext` - The MessageContext of the Request Message
        `is` - The input stream of the request
        `os` - The output stream of the response
        `requestURI` - The URL that the request came to
        `contentTypeHeader` - The contentType header of the request
        `dispatching` - Weather we should do dispatching
      Throws:
        `org.apache.axis2.AxisFault` - - Thrown in case a fault occurs

    - #### processPOSTRequest

          public static void processPOSTRequest(org.apache.axis2.context.MessageContext msgContext,
                                                InputStream is,
                                                OutputStream os,
                                                String requestURI,
                                                String contentType,
                                                boolean dispatching)
                                         throws org.apache.axis2.AxisFault

      Processes the HTTP POST request and builds the SOAP info-set of the REST message
      Parameters:
        `msgContext` - MessageContext of the Request Message
        `is` - Input stream of the request
        `os` - Output stream of the response
        `requestURI` - URL that the request came to
        `contentType` - ContentType header of the request
        `dispatching` - Whether we should do dispatching
      Throws:
        `org.apache.axis2.AxisFault` - - Thrown in case a fault occurs

    - #### dispatchAndVerify

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

      Throws:
        `org.apache.axis2.AxisFault`

    - #### findOperation

          public static org.apache.axis2.description.AxisOperation findOperation(org.apache.axis2.description.AxisService svc,
                                                                                 org.apache.axis2.context.MessageContext mc)

      Get the axis operation from the operation name used by the Synapse service (for message mediation).
      Parameters:
        `svc` - axis service
        `mc` - messageContext message context
      Returns:
        axis operation for the message context

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