svn commit: r698424 - /activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r698424 - /activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java

hadrian-3
Author: hadrian
Date: Tue Sep 23 21:08:13 2008
New Revision: 698424

URL: http://svn.apache.org/viewvc?rev=698424&view=rev
Log:
A bit of minor code cleanup.

Modified:
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=698424&r1=698423&r2=698424&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java Tue Sep 23 21:08:13 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.http;
 
-
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
@@ -49,7 +48,7 @@
     // This should be a set of lower-case strings
     @Deprecated
     public static final Set<String> HEADERS_TO_SKIP =
-            new HashSet<String>(Arrays.asList("content-length", "content-type", HTTP_RESPONSE_CODE.toLowerCase()));
+        new HashSet<String>(Arrays.asList("content-length", "content-type", HTTP_RESPONSE_CODE.toLowerCase()));
     private HttpClient httpClient;
 
     public HttpProducer(HttpEndpoint endpoint) {
@@ -110,12 +109,10 @@
 
         RequestEntity requestEntity = createRequestEntity(exchange);
         Object m = exchange.getIn().getHeader(HTTP_METHOD);
-        // TODO: Damm this is not readable code (nested ? - please dont)
-        HttpMethods ms = m instanceof HttpMethods
-            ? (HttpMethods)m : HttpMethods.valueOf(m == null
-                                                       ? requestEntity == null
-                                                           ? "GET" : "POST"
-                                                               : m.toString());
+        
+        HttpMethods ms = requestEntity == null ? HttpMethods.GET : HttpMethods.POST;
+        ms = m instanceof HttpMethods ? (HttpMethods)m :
+            m == null ? ms : HttpMethods.valueOf(m.toString());
 
         HttpMethod method = ms.createMethod(uri);