Class RESTUtil
java.lang.Object
org.apache.synapse.transport.nhttp.util.RESTUtil
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddispatchAndVerify(org.apache.axis2.context.MessageContext msgContext) static org.apache.axis2.description.AxisOperationfindOperation(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 StringThis method will return the URI part for the GET HTTPRequest by converting the SOAP infoset to the URL-encoded GET formatstatic voidprocessGetAndDeleteRequest(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 messagestatic voidprocessPOSTRequest(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 messagestatic voidprocessPOSTRequest(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 messagestatic voidprocessURLRequest(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
-
Constructor Details
-
RESTUtil
public RESTUtil()
-
-
Method Details
-
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 encodeaddress- - 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 Messageout- The output stream of the responserequestURI- The URL that the request came tocontentTypeHeader- The contentType header of the requesthttpMethod- The http method of the requestdispatching- 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 Messageout- The output stream of the responsesoapAction- SoapAction of the requestrequestURI- 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 Messageis- The input stream of the requestos- The output stream of the responserequestURI- The URL that the request came tocontentTypeHeader- The contentType header of the requestdispatching- 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 Messageis- Input stream of the requestos- Output stream of the responserequestURI- URL that the request came tocontentType- ContentType header of the requestdispatching- 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 servicemc- messageContext message context- Returns:
- axis operation for the message context
-