You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2008/07/12 12:54:36 UTC

svn commit: r676145 - in /ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding: HttpClientHelper.java HttpExternalService.java HttpHelper.java HttpMethodConverter.java

Author: midon
Date: Sat Jul 12 03:54:36 2008
New Revision: 676145

URL: http://svn.apache.org/viewvc?rev=676145&view=rev
Log:
rename HttpClientHelper into HttpHelper

Added:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java
      - copied, changed from r676144, ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java
Removed:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java
Modified:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=676145&r1=676144&r2=676145&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Sat Jul 12 03:54:36 2008
@@ -149,7 +149,7 @@
             client.getParams().setDefaults(params);
 
             // configure the client (proxy, security, etc)
-            HttpClientHelper.configure(client.getHostConfiguration(), client.getState(), method.getURI(), params);
+            HttpHelper.configure(client.getHostConfiguration(), client.getState(), method.getURI(), params);
 
             // this callable encapsulates the http method execution and the process of the response 
             final Callable executionCallable;
@@ -268,7 +268,7 @@
         private void unmanagedStatus() throws IOException {
             String errmsg = "Unmanaged Status Code! Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
             log.error(errmsg);
-            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
         }
 
         /**
@@ -286,15 +286,15 @@
             if (opDef.getFaults().isEmpty()) {
                 errmsg = "Operation [" + opDef.getName() + "] has no fault. This 500 error will be considered as a failure.";
                 log.error(errmsg);
-                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
             } else if (opBinding.getBindingFaults().isEmpty()) {
                 errmsg = "No fault binding. This 500 error will be considered as a failure.";
                 log.error(errmsg);
-                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
             } else if (StringUtils.isEmpty(body)) {
                 errmsg = "No body in the response. This 500 error will be considered as a failure.";
                 log.error(errmsg);
-                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
             } else {
                 try {
                     Element bodyEl = DOMUtils.stringToDOM(body);
@@ -304,12 +304,12 @@
                     if (faultDef == null) {
                         errmsg = "Unknown Fault Type [" + bodyName + "] This 500 error will be considered as a failure.";
                         log.error(errmsg);
-                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
                     } else if (!WsdlUtils.isOdeFault(opBinding.getBindingFault(faultDef.getName()))) {
                         // is this fault bound with ODE extension?
                         errmsg = "Fault [" + bodyName + "] is not bound with " + new QName(Namespaces.ODE_HTTP_EXTENSION_NS, "fault") + ". This 500 error will be considered as a failure.";
                         log.error(errmsg);
-                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
                     } else {
                         // a fault must have only one part
                         Part partDef = (Part) faultDef.getMessage().getParts().values().iterator().next();
@@ -336,7 +336,7 @@
                 } catch (Exception e) {
                     errmsg = "Unable to parse the response body as xml. This 500 error will be considered as a failure.";
                     log.error(errmsg, e);
-                    odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method, false));
+                    odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method, false));
                 }
             }
         }
@@ -344,13 +344,13 @@
         private void _4xx_badRequest() throws IOException {
             String errmsg = "HTTP Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
             log.error(errmsg);
-            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
         }
 
         private void _3xx_redirection() throws IOException {
             String errmsg = "Redirections disabled! HTTP Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
             log.error(errmsg);
-            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
         }
 
         private void _2xx_success() throws IOException {
@@ -400,7 +400,7 @@
                     } catch (Exception ex) {
                         String errmsg = "Unable to process response: " + ex.getMessage();
                         log.error(errmsg, ex);
-                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
+                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpHelper.prepareDetailsElement(method));
                     }
                 }
             } catch (IOException e) {

Copied: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java (from r676144, ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java)
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java?p2=ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java&p1=ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java&r1=676144&r2=676145&rev=676145&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java Sat Jul 12 03:54:36 2008
@@ -27,50 +27,22 @@
 import org.apache.commons.httpclient.URIException;
 import org.apache.commons.httpclient.StatusLine;
 import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
 import org.apache.commons.httpclient.params.HttpParams;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.lang.StringUtils;
 import org.apache.ode.axis2.Properties;
-import org.apache.ode.axis2.util.URLEncodedTransformer;
-import org.apache.ode.axis2.util.UrlReplacementTransformer;
-import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
 import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.wsdl.Messages;
-import org.apache.ode.utils.wsdl.WsdlUtils;
-import org.apache.ode.il.epr.MutableEndpoint;
 import org.w3c.dom.Element;
 import org.w3c.dom.Document;
 
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Part;
-import javax.wsdl.extensions.http.HTTPOperation;
-import javax.wsdl.extensions.mime.MIMEContent;
-import javax.xml.namespace.QName;
-import java.io.UnsupportedEncodingException;
 import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public class HttpClientHelper {
+public class HttpHelper {
 
-    private static final Log log = LogFactory.getLog(HttpClientHelper.class);
+    private static final Log log = LogFactory.getLog(HttpHelper.class);
 
     public static void configure(HostConfiguration hostConfig, HttpState state, URI targetURI, HttpParams params) throws URIException {
         if (log.isDebugEnabled()) log.debug("Configuring http client...");

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java?rev=676145&r1=676144&r2=676145&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java Sat Jul 12 03:54:36 2008
@@ -62,8 +62,6 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Collection;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
 
 public class HttpMethodConverter {
 
@@ -253,7 +251,7 @@
                 if (log.isErrorEnabled()) log.error(errMsg);
                 throw new RuntimeException(errMsg);
             }
-            method.setRequestHeader(headerName, HttpClientHelper.replaceCRLFwithLWS(headerValue));
+            method.setRequestHeader(headerName, HttpHelper.replaceCRLFwithLWS(headerValue));
         }
 
         // process message headers
@@ -264,7 +262,7 @@
             // set the request header but do not override any part value
             if (method.getRequestHeader(headerName) == null) {
                 String headerValue = DOMUtils.domToString(headerNode);
-                method.setRequestHeader(headerName, HttpClientHelper.replaceCRLFwithLWS(headerValue));
+                method.setRequestHeader(headerName, HttpHelper.replaceCRLFwithLWS(headerValue));
             }
         }
 
@@ -381,7 +379,7 @@
         }
 
         // make the status line information available as a single element
-        odeMessage.setHeaderPart("Status-Line", HttpClientHelper.statusLineToElement(method.getStatusLine()));
+        odeMessage.setHeaderPart("Status-Line", HttpHelper.statusLineToElement(method.getStatusLine()));
     }