http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
deleted file mode 100644
index 8c7e265..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-
-/**
- * @version 
- */
-public class HttpHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
-    
-    public HttpHeaderFilterStrategy() {
-        initialize();  
-    }
-
-    protected void initialize() {
-        getOutFilter().add("content-length");
-        getOutFilter().add("content-type");
-        getOutFilter().add("host");
-        // Add the filter for the Generic Message header
-        // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
-        getOutFilter().add("cache-control");
-        getOutFilter().add("connection");
-        getOutFilter().add("date");
-        getOutFilter().add("pragma");
-        getOutFilter().add("trailer");
-        getOutFilter().add("transfer-encoding");
-        getOutFilter().add("upgrade");
-        getOutFilter().add("via");
-        getOutFilter().add("warning");
-        
-        setLowerCase(true);
-        
-        // filter headers begin with "Camel" or "org.apache.camel"
-        // must ignore case for Http based transports
-        
setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
deleted file mode 100644
index f8e8cfd..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import java.io.IOException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.impl.DefaultMessage;
-import org.apache.camel.util.ObjectHelper;
-
-/**
- * @version 
- */
-public class HttpMessage extends DefaultMessage {
-
-    private HttpServletRequest request;
-    private HttpServletResponse response;
-
-    public HttpMessage(Exchange exchange, HttpServletRequest request, 
HttpServletResponse response) {
-        setExchange(exchange);
-        this.request = request;
-        this.response = response;
-        // Put the request and response into the message header
-        this.setHeader(Exchange.HTTP_SERVLET_REQUEST, request);
-        this.setHeader(Exchange.HTTP_SERVLET_RESPONSE, response);
-        
-        // Check the setting of exchange
-        Boolean flag = exchange.getProperty(Exchange.SKIP_WWW_FORM_URLENCODED, 
Boolean.class);
-        if (flag != null && flag) {
-            this.setHeader(Exchange.SKIP_WWW_FORM_URLENCODED, Boolean.TRUE);
-        }
-
-        // use binding to read the request allowing end users to use their
-        // implementation of the binding
-        getEndpoint().getBinding().readRequest(request, this);
-    }
-
-    public HttpServletRequest getRequest() {
-        return request;
-    }
-
-    public HttpServletResponse getResponse() {
-        return response;
-    }
-
-    @Override
-    protected Object createBody() {
-        try {
-            return getEndpoint().getBinding().parseBody(this);
-        } catch (IOException e) {
-            throw new RuntimeCamelException(e);
-        }
-    }
-    
-    private HttpEndpoint getEndpoint() {
-        return (HttpEndpoint) getExchange().getFromEndpoint();
-    }
-
-    @Override
-    public String toString() {
-        // do not use toString on HTTP message
-        return "HttpMessage@" + ObjectHelper.getIdentityHashCode(this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java
deleted file mode 100644
index 2e681d4..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import java.util.Map;
-
-import org.apache.camel.CamelException;
-import org.apache.camel.util.ObjectHelper;
-
-public class HttpOperationFailedException extends CamelException {
-    private static final long serialVersionUID = -8721487434390572634L;
-    private final String uri;
-    private final String redirectLocation;
-    private final int statusCode;
-    private final String statusText;
-    private final Map<String, String> responseHeaders;
-    private final String responseBody;
-
-    public HttpOperationFailedException(String uri, int statusCode, String 
statusText, String location, Map<String, String> responseHeaders, String 
responseBody) {
-        super("HTTP operation failed invoking " + uri + " with statusCode: " + 
statusCode + (location != null ? ", redirectLocation: " + location : ""));
-        this.uri = uri;
-        this.statusCode = statusCode;
-        this.statusText = statusText;
-        this.redirectLocation = location;
-        this.responseHeaders = responseHeaders;
-        this.responseBody = responseBody;
-    }
-
-    public String getUri() {
-        return uri;
-    }
-
-    public boolean isRedirectError() {
-        return statusCode >= 300 && statusCode < 400;
-    }
-
-    public boolean hasRedirectLocation() {
-        return ObjectHelper.isNotEmpty(redirectLocation);
-    }
-
-    public String getRedirectLocation() {
-        return redirectLocation;
-    }
-
-    public int getStatusCode() {
-        return statusCode;
-    }
-
-    public String getStatusText() {
-        return statusText;
-    }
-
-    public Map<String, String> getResponseHeaders() {
-        return responseHeaders;
-    }
-
-    public String getResponseBody() {
-        return responseBody;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
index 403bb02..6a224eb 100644
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
+++ 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.ServicePoolAware;
-import org.apache.camel.component.http.helper.HttpHelper;
+import org.apache.camel.http.common.HttpHelper;
 import org.apache.camel.impl.PollingConsumerSupport;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.commons.httpclient.Header;
@@ -103,6 +103,7 @@ public class HttpPollingConsumer extends 
PollingConsumerSupport implements Servi
 
     // Properties
     //-------------------------------------------------------------------------
+
     public HttpClient getHttpClient() {
         return httpClient;
     }
@@ -113,6 +114,7 @@ public class HttpPollingConsumer extends 
PollingConsumerSupport implements Servi
 
     // Implementation methods
     //-------------------------------------------------------------------------
+
     protected HttpMethod createMethod(Exchange exchange) {
         String uri = HttpHelper.createURL(exchange, endpoint);
         return new GetMethod(uri);

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
index 4edde30..5d48cea 100644
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
+++ 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
@@ -33,8 +33,12 @@ import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.component.file.GenericFile;
-import org.apache.camel.component.http.helper.HttpHelper;
+import org.apache.camel.component.http.helper.HttpMethodsHelper;
 import org.apache.camel.converter.stream.CachedOutputStream;
+import org.apache.camel.http.common.HttpConstants;
+import org.apache.camel.http.common.HttpHelper;
+import org.apache.camel.http.common.HttpOperationFailedException;
+import org.apache.camel.http.common.HttpProtocolHeaderFilterStrategy;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ExchangeHelper;
@@ -366,7 +370,7 @@ public class HttpProducer extends DefaultProducer {
 
         // create http holder objects for the request
         RequestEntity requestEntity = createRequestEntity(exchange);
-        HttpMethods methodToUse = HttpHelper.createMethod(exchange, 
getEndpoint(), requestEntity != null);
+        HttpMethods methodToUse = HttpMethodsHelper.createMethod(exchange, 
getEndpoint(), requestEntity != null);
         HttpMethod method = methodToUse.createMethod(url);
         if (queryString != null) {
             // need to encode query string

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
deleted file mode 100644
index d8398ae..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-
-
-public class HttpProtocolHeaderFilterStrategy extends 
DefaultHeaderFilterStrategy {
-    
-    public HttpProtocolHeaderFilterStrategy() {
-        initialize();  
-    }
-
-    // Just add the http headers here 
-    protected void initialize() {
-        getInFilter().add("host");
-        
-        getInFilter().add("content-encoding");
-        getInFilter().add("content-language");
-        getInFilter().add("content-location");
-        getInFilter().add("content-md5");
-        getInFilter().add("content-length");
-        getInFilter().add("content-type");
-        getInFilter().add("content-range");
-        
-        getInFilter().add("dav");
-        getInFilter().add("depth");
-        getInFilter().add("destination");
-        getInFilter().add("etag");
-        getInFilter().add("expect");
-        getInFilter().add("expires");
-        getInFilter().add("from");
-        getInFilter().add("if");
-        getInFilter().add("if-match");
-        getInFilter().add("if-modified-since");
-        getInFilter().add("if-none-match");
-        getInFilter().add("if-range");
-        getInFilter().add("if-unmodified-since");
-        getInFilter().add("last-modified");
-        getInFilter().add("location");
-        getInFilter().add("lock-token");
-        getInFilter().add("max-forwards");
-        getInFilter().add("overwrite");
-        getInFilter().add("pragma");
-        getInFilter().add("proxy-authenticate");
-        getInFilter().add("proxy-authorization");
-        getInFilter().add("range");
-        getInFilter().add("referer");
-        getInFilter().add("retry-after");
-        getInFilter().add("server");
-        getInFilter().add("status-uri");
-        getInFilter().add("te");
-        getInFilter().add("timeout");
-      
-        getInFilter().add("user-agent");
-        getInFilter().add("vary");
-  
-        getInFilter().add("www-authenticate");
-        
-        // Add the filter for the Generic Message header
-        // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
-        getInFilter().add("cache-control");
-        getInFilter().add("connection");
-        getInFilter().add("date");
-        getInFilter().add("pragma");
-        getInFilter().add("trailer");
-        getInFilter().add("transfer-encoding");
-        getInFilter().add("upgrade");
-        getInFilter().add("via");
-        getInFilter().add("warning");
-               
-        setLowerCase(true);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletResolveConsumerStrategy.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletResolveConsumerStrategy.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletResolveConsumerStrategy.java
deleted file mode 100644
index de7ed4a..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletResolveConsumerStrategy.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * A default implementation of {@link 
org.apache.camel.component.http.ServletResolveConsumerStrategy}.
- */
-public class HttpServletResolveConsumerStrategy implements 
ServletResolveConsumerStrategy {
-
-    @Override
-    public HttpConsumer resolve(HttpServletRequest request, Map<String, 
HttpConsumer> consumers) {
-        String path = request.getPathInfo();
-        if (path == null) {
-            return null;
-        }
-        HttpConsumer answer = consumers.get(path);
-
-        if (answer == null) {
-            for (String key : consumers.keySet()) {
-                //We need to look up the consumer path here
-                String consumerPath = consumers.get(key).getPath();
-                HttpConsumer consumer = consumers.get(key);
-                // Just make sure the we get the right consumer path first
-                if (consumerPath.equals(path) || 
(consumer.getEndpoint().isMatchOnUriPrefix() && path.startsWith(consumerPath))) 
{
-                    answer = consumers.get(key);
-                    break;
-                }
-            }
-        }
-        return answer;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletUrlRewrite.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletUrlRewrite.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletUrlRewrite.java
deleted file mode 100644
index 3780e22..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpServletUrlRewrite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.camel.Producer;
-
-/**
- * Extended {@link UrlRewrite} which leverages {@link HttpServletRequest}
- * during the rewrite process.
- * <p/>
- * For example the camel-urlrewrite component supports
- * {@link HttpServletUrlRewrite} implementations.
- */
-public interface HttpServletUrlRewrite extends UrlRewrite {
-
-    /**
-     * Rewrite the url.
-     *
-     * @param url  the absolute url (eg with scheme://host:port/path?query)
-     * @param relativeUrl optional relative url, if bridging endpoints, which 
then would be without the base path from the
-     *                    endpoint from the given producer.
-     * @param producer the producer to use the rewritten url
-     * @param request  the http servlet request
-     * @return the rewritten url, or <tt>null</tt> to use the original url
-     * @throws Exception is thrown if error rewriting the url
-     */
-    String rewrite(String url, String relativeUrl, Producer producer, 
HttpServletRequest request) throws Exception;
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
index 94c2acb..ea6a42c 100644
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
+++ 
b/components/camel-http/src/main/java/org/apache/camel/component/http/SSLContextParametersSecureProtocolSocketFactory.java
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.UnknownHostException;
-
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
 
@@ -33,7 +32,7 @@ import 
org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
 
 /**
  * A {@code SecureProtocolSocketFactory} implementation to allow configuration
- * of Commons HTTP SSL/TLS options based on a {@link #JSSEClientParameters}
+ * of Commons HTTP SSL/TLS options based on a JSSEClientParameters
  * instance or a provided {@code SSLSocketFactory} instance.
  */
 public class SSLContextParametersSecureProtocolSocketFactory implements 
SecureProtocolSocketFactory {

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/ServletResolveConsumerStrategy.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/ServletResolveConsumerStrategy.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/ServletResolveConsumerStrategy.java
deleted file mode 100644
index 68f27fa..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/ServletResolveConsumerStrategy.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Strategy to resolve which consumer to service an incoming {@link 
javax.servlet.http.HttpServletRequest}.
- */
-public interface ServletResolveConsumerStrategy {
-
-    /**
-     * Resolve the consumer to use.
-     *
-     * @param request   the http request
-     * @param consumers the map of registered consumers
-     * @return the consumer to service the request, or <tt>null</tt> if no 
match,
-     * which sends back a {@link 
javax.servlet.http.HttpServletResponse#SC_NOT_FOUND} to the client.
-     */
-    HttpConsumer resolve(HttpServletRequest request, Map<String, HttpConsumer> 
consumers);
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/UrlRewrite.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/UrlRewrite.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/UrlRewrite.java
deleted file mode 100644
index cd26624..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/UrlRewrite.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http;
-
-import org.apache.camel.Producer;
-
-/**
- * Allows to plugin custom strategy for rewriting url.
- * <p/>
- * This allows for example to proxy http services and plugin a url rewrite
- * strategy such as the <a 
href="http://camel.apache.org/urlrewrite";>url-rewrite</a> component.
- */
-public interface UrlRewrite {
-
-    /**
-     * Rewrite the url.
-     *
-     * @param url  the absolute url (eg with scheme://host:port/path?query)
-     * @param relativeUrl optional relative url, if bridging endpoints, which 
then would be without the base path from the
-     *                    endpoint from the given producer.
-     * @param producer the producer to use the rewritten url
-     * @return the rewritten url, or <tt>null</tt> to use the original url
-     * @throws Exception is thrown if error rewriting the url
-     */
-    String rewrite(String url, String relativeUrl, Producer producer) throws 
Exception;
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/helper/CamelFileDataSource.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/CamelFileDataSource.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/CamelFileDataSource.java
deleted file mode 100644
index a1934f5..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/CamelFileDataSource.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http.helper;
-
-import java.io.File;
-
-import javax.activation.FileDataSource;
-import javax.activation.FileTypeMap;
-
-public class CamelFileDataSource extends FileDataSource {
-    private final String fileName;
-    private FileTypeMap typeMap;
-
-    public CamelFileDataSource(File file, String fileName) {
-        super(file);
-        this.fileName = fileName;
-    }
-    
-    public String getContentType() {
-        if (typeMap == null) {
-            return 
FileTypeMap.getDefaultFileTypeMap().getContentType(fileName);
-        } else {
-            return typeMap.getContentType(fileName);
-        }
-    }
-    
-    public void setFileTypeMap(FileTypeMap map) {
-        typeMap = map;
-    }
-    
-    public String getName() {
-        if (fileName != null) {
-            return fileName;
-        } else {
-            return super.getName();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
deleted file mode 100644
index d4f4620..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http.helper;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeExchangeException;
-import org.apache.camel.component.http.HttpConstants;
-import org.apache.camel.component.http.HttpConverter;
-import org.apache.camel.component.http.HttpEndpoint;
-import org.apache.camel.component.http.HttpMessage;
-import org.apache.camel.component.http.HttpMethods;
-import org.apache.camel.component.http.HttpServletUrlRewrite;
-import org.apache.camel.converter.IOConverter;
-import org.apache.camel.converter.stream.CachedOutputStream;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.util.CamelObjectInputStream;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.URISupport;
-import org.apache.camel.util.UnsafeUriCharactersEncoder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class HttpHelper {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(HttpHelper.class);
-
-    private HttpHelper() {
-        // Helper class
-    }
-
-    @SuppressWarnings("deprecation")
-    public static void setCharsetFromContentType(String contentType, Exchange 
exchange) {
-        if (contentType != null) {
-            // find the charset and set it to the Exchange
-            int index = contentType.indexOf("charset=");
-            if (index > 0) {
-                String charset = contentType.substring(index + 8);
-                exchange.setProperty(Exchange.CHARSET_NAME, 
IOConverter.normalizeCharset(charset));
-            }
-        }
-    }
-
-    public static String getCharsetFromContentType(String contentType) {
-        if (contentType != null) {
-            // find the charset and set it to the Exchange
-            int index = contentType.indexOf("charset=");
-            if (index > 0) {
-                String charset = contentType.substring(index + 8);
-                // there may be another parameter after a semi colon, so skip 
that
-                if (charset.contains(";")) {
-                    charset = ObjectHelper.before(charset, ";");
-                }
-                return IOHelper.normalizeCharset(charset);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Writes the given object as response body to the servlet response
-     * <p/>
-     * The content type will be set to {@link 
HttpConstants#CONTENT_TYPE_JAVA_SERIALIZED_OBJECT}
-     *
-     * @param response servlet response
-     * @param target   object to write
-     * @throws IOException is thrown if error writing
-     */
-    public static void writeObjectToServletResponse(ServletResponse response, 
Object target) throws IOException {
-        
response.setContentType(HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
-        writeObjectToStream(response.getOutputStream(), target);
-    }
-
-    /**
-     * Writes the given object as response body to the output stream
-     *
-     * @param stream output stream
-     * @param target   object to write
-     * @throws IOException is thrown if error writing
-     */
-    public static void writeObjectToStream(OutputStream stream, Object target) 
throws IOException {
-        ObjectOutputStream oos = new ObjectOutputStream(stream);
-        oos.writeObject(target);
-        oos.flush();
-        IOHelper.close(oos);
-    }
-
-    /**
-     * Deserializes the input stream to a Java object
-     *
-     * @param is input stream for the Java object
-     * @return the java object, or <tt>null</tt> if input stream was 
<tt>null</tt>
-     * @throws ClassNotFoundException is thrown if class not found
-     * @throws IOException can be thrown
-     * @deprecated Camel 3.0 
-     * Please use the one which has the parameter of camel context
-     */
-    @Deprecated
-    public static Object deserializeJavaObjectFromStream(InputStream is) 
throws ClassNotFoundException, IOException {
-        return deserializeJavaObjectFromStream(is, null);
-    }
-    
-    /**
-     * Deserializes the input stream to a Java object
-     *
-     * @param is input stream for the Java object
-     * @param context the camel context which could help us to apply the 
customer classloader
-     * @return the java object, or <tt>null</tt> if input stream was 
<tt>null</tt>
-     * @throws ClassNotFoundException is thrown if class not found
-     * @throws IOException can be thrown
-     */
-    public static Object deserializeJavaObjectFromStream(InputStream is, 
CamelContext context) throws ClassNotFoundException, IOException {
-        if (is == null) {
-            return null;
-        }
-
-        Object answer = null;
-        ObjectInputStream ois = new CamelObjectInputStream(is, context);
-        try {
-            answer = ois.readObject();
-        } finally {
-            IOHelper.close(ois);
-        }
-
-        return answer;
-    }
-
-    /**
-     * Reads the response body from the given http servlet request.
-     *
-     * @param request  http servlet request
-     * @param exchange the exchange
-     * @return the request body, can be <tt>null</tt> if no body
-     * @throws IOException is thrown if error reading response body
-     */
-    public static Object readRequestBodyFromServletRequest(HttpServletRequest 
request, Exchange exchange) throws IOException {
-        InputStream is = HttpConverter.toInputStream(request, exchange);
-        return readResponseBodyFromInputStream(is, exchange);
-    }
-    
-    /**
-     * Reads the response body from the given input stream.
-     *
-     * @param is       the input stream
-     * @param exchange the exchange
-     * @return the response body, can be <tt>null</tt> if no body
-     * @throws IOException is thrown if error reading response body
-     */
-    public static Object readRequestBodyFromInputStream(InputStream is, 
Exchange exchange) throws IOException {
-        if (is == null) {
-            return null;
-        }
-        boolean disableStreamCaching = false;
-        // Just take the consideration of the setting of Camel Context 
StreamCaching
-        if (exchange.getContext() instanceof DefaultCamelContext) { 
-            DefaultCamelContext context = (DefaultCamelContext) 
exchange.getContext();
-            disableStreamCaching = !context.isStreamCaching();
-        }
-        // convert the input stream to StreamCache if the stream cache is not 
disabled
-        if (exchange.getProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, 
disableStreamCaching, Boolean.class)) {
-            return is;
-        } else {
-            CachedOutputStream cos = new CachedOutputStream(exchange);
-            IOHelper.copyAndCloseInput(is, cos);
-            return cos.newStreamCache();
-        }
-    }
-
-
-    /**
-     * Reads the response body from the given input stream.
-     *
-     * @param is       the input stream
-     * @param exchange the exchange
-     * @return the response body, can be <tt>null</tt> if no body
-     * @throws IOException is thrown if error reading response body
-     */
-    public static Object readResponseBodyFromInputStream(InputStream is, 
Exchange exchange) throws IOException {
-        if (is == null) {
-            return null;
-        }
-        // convert the input stream to StreamCache if the stream cache is not 
disabled
-        if (exchange.getProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, 
Boolean.FALSE, Boolean.class)) {
-            return is;
-        } else {
-            CachedOutputStream cos = new CachedOutputStream(exchange);
-            IOHelper.copyAndCloseInput(is, cos);
-            return cos.newStreamCache();
-        }
-    }
-
-    /**
-     * Creates the URL to invoke.
-     *
-     * @param exchange the exchange
-     * @param endpoint the endpoint
-     * @return the URL to invoke
-     */
-    public static String createURL(Exchange exchange, HttpEndpoint endpoint) {
-        String uri = null;
-        if (!(endpoint.isBridgeEndpoint())) {
-            uri = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
-        }
-        if (uri == null) {
-            uri = endpoint.getHttpUri().toASCIIString();
-        }
-
-        // resolve placeholders in uri
-        try {
-            uri = exchange.getContext().resolvePropertyPlaceholders(uri);
-        } catch (Exception e) {
-            throw new RuntimeExchangeException("Cannot resolve property 
placeholders with uri: " + uri, exchange, e);
-        }
-
-        // append HTTP_PATH to HTTP_URI if it is provided in the header
-        String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, 
String.class);
-        // NOW the HTTP_PATH is just related path, we don't need to trim it
-        if (path != null) {
-            if (path.startsWith("/")) {
-                path = path.substring(1);
-            }
-            if (path.length() > 0) {
-                // make sure that there is exactly one "/" between HTTP_URI and
-                // HTTP_PATH
-                if (!uri.endsWith("/")) {
-                    uri = uri + "/";
-                }
-                uri = uri.concat(path);
-            }
-        }
-
-        // ensure uri is encoded to be valid
-        uri = UnsafeUriCharactersEncoder.encodeHttpURI(uri);
-
-        return uri;
-    }
-
-    /**
-     * Creates the URI to invoke.
-     *
-     * @param exchange the exchange
-     * @param url      the url to invoke
-     * @param endpoint the endpoint
-     * @return the URI to invoke
-     */
-    public static URI createURI(Exchange exchange, String url, HttpEndpoint 
endpoint) throws URISyntaxException {
-        URI uri = new URI(url);
-        // is a query string provided in the endpoint URI or in a header 
(header overrules endpoint)
-        String queryString = exchange.getIn().getHeader(Exchange.HTTP_QUERY, 
String.class);
-        if (queryString == null) {
-            queryString = endpoint.getHttpUri().getRawQuery();
-        }
-        // We should user the query string from the HTTP_URI header
-        if (queryString == null) {
-            queryString = uri.getRawQuery();
-        }
-        if (queryString != null) {
-            // need to encode query string
-            queryString = 
UnsafeUriCharactersEncoder.encodeHttpURI(queryString);
-            uri = URISupport.createURIWithQuery(uri, queryString);
-        }
-        return uri;
-    }
-
-    /**
-     * Creates the HttpMethod to use to call the remote server, often either 
its GET or POST.
-     *
-     * @param exchange  the exchange
-     * @return the created method
-     * @throws URISyntaxException
-     */
-    public static HttpMethods createMethod(Exchange exchange, HttpEndpoint 
endpoint, boolean hasPayload) throws URISyntaxException {
-        // compute what method to use either GET or POST
-        HttpMethods answer;
-        HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, 
HttpMethods.class);
-        if (m != null) {
-            // always use what end-user provides in a header
-            answer = m;
-        } else if (hasPayload) {
-            // use POST if we have payload
-            answer = HttpMethods.POST;
-        } else {
-            // fallback to GET
-            answer = HttpMethods.GET;
-        }
-
-        return answer;
-    }
-
-    /**
-     * Appends the key/value to the headers.
-     * <p/>
-     * This implementation supports keys with multiple values. In such 
situations the value
-     * will be a {@link java.util.List} that contains the multiple values.
-     *
-     * @param headers  headers
-     * @param key      the key
-     * @param value    the value
-     */
-    @SuppressWarnings("unchecked")
-    public static void appendHeader(Map<String, Object> headers, String key, 
Object value) {
-        if (headers.containsKey(key)) {
-            Object existing = headers.get(key);
-            List<Object> list;
-            if (existing instanceof List) {
-                list = (List<Object>) existing;
-            } else {
-                list = new ArrayList<Object>();
-                list.add(existing);
-            }
-            list.add(value);
-            value = list;
-        }
-
-        headers.put(key, value);
-    }
-
-    /**
-     * Extracts the parameter value.
-     * <p/>
-     * This implementation supports HTTP multi value parameters which
-     * is based on the syntax of <tt>[value1, value2, value3]</tt> by returning
-     * a {@link List} containing the values.
-     * <p/>
-     * If the value is not a HTTP mulit value the value is returned as is.
-     *
-     * @param value the parameter value
-     * @return the extracted parameter value, see more details in javadoc.
-     */
-    public static Object extractHttpParameterValue(String value) {
-        if (value == null || ObjectHelper.isEmpty(value)) {
-            return value;
-        }
-
-        // trim value before checking for multiple parameters
-        String trimmed = value.trim();
-
-        if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
-            // remove the [ ] markers
-            trimmed = trimmed.substring(1, trimmed.length() - 1);
-            List<String> list = new ArrayList<String>();
-            String[] values = trimmed.split(",");
-            for (String s : values) {
-                list.add(s.trim());
-            }
-            return list;
-        }
-
-        return value;
-    }
-
-    /**
-     * Processes any custom {@link org.apache.camel.component.http.UrlRewrite}.
-     *
-     * @param exchange    the exchange
-     * @param url         the url
-     * @param endpoint    the http endpoint
-     * @param producer    the producer
-     * @return            the rewritten url, or <tt>null</tt> to use original 
url
-     * @throws Exception is thrown if any error during rewriting url
-     */
-    public static String urlRewrite(Exchange exchange, String url, 
HttpEndpoint endpoint, Producer producer) throws Exception {
-        String answer = null;
-
-        String relativeUrl;
-        if (endpoint.getUrlRewrite() != null) {
-            // we should use the relative path if possible
-            String baseUrl;
-            relativeUrl = endpoint.getHttpUri().toASCIIString();
-            if (url.startsWith(relativeUrl)) {
-                baseUrl = url.substring(0, relativeUrl.length());
-                relativeUrl = url.substring(relativeUrl.length());
-            } else {
-                baseUrl = null;
-                relativeUrl = url;
-            }
-            // mark it as null if its empty
-            if (ObjectHelper.isEmpty(relativeUrl)) {
-                relativeUrl = null;
-            }
-
-            String newUrl;
-            if (endpoint.getUrlRewrite() instanceof HttpServletUrlRewrite) {
-                // its servlet based, so we need the servlet request
-                HttpServletRequest request = 
exchange.getIn().getBody(HttpServletRequest.class);
-                if (request == null) {
-                    HttpMessage msg = exchange.getIn(HttpMessage.class);
-                    if (msg != null) {
-                        request = msg.getRequest();
-                    }
-                }
-                if (request == null) {
-                    throw new IllegalArgumentException("UrlRewrite " + 
endpoint.getUrlRewrite() + " requires the message body to be a"
-                            + "HttpServletRequest instance, but was: " + 
ObjectHelper.className(exchange.getIn().getBody()));
-                }
-                // we need to adapt the context-path to be the path from the 
endpoint, if it came from a http based endpoint
-                // as eg camel-jetty have hardcoded context-path as / for all 
its servlets/endpoints
-                // we have the actual context-path stored as a header with the 
key CamelServletContextPath
-                String contextPath = 
exchange.getIn().getHeader("CamelServletContextPath", String.class);
-                request = new UrlRewriteHttpServletRequestAdapter(request, 
contextPath);
-                newUrl = ((HttpServletUrlRewrite) 
endpoint.getUrlRewrite()).rewrite(url, relativeUrl, producer, request);
-            } else {
-                newUrl = endpoint.getUrlRewrite().rewrite(url, relativeUrl, 
producer);
-            }
-
-            if (ObjectHelper.isNotEmpty(newUrl) && !newUrl.equals(url)) {
-                // we got a new url back, that can either be a new absolute url
-                // or a new relative url
-                if (newUrl.startsWith("http:") || newUrl.startsWith("https:")) 
{
-                    answer = newUrl;
-                } else if (baseUrl != null) {
-                    // avoid double // when adding the urls
-                    if (baseUrl.endsWith("/") && newUrl.startsWith("/")) {
-                        answer = baseUrl + newUrl.substring(1);
-                    } else {
-                        answer = baseUrl + newUrl;
-                    }
-                } else {
-                    // use the new url as is
-                    answer = newUrl;
-                }
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Using url rewrite to rewrite from url {} to {} 
-> {}",
-                            new Object[]{relativeUrl != null ? relativeUrl : 
url, newUrl, answer});
-                }
-            }
-        }
-
-        return answer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodsHelper.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodsHelper.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodsHelper.java
new file mode 100644
index 0000000..2aa04f1
--- /dev/null
+++ 
b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpMethodsHelper.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.http.helper;
+
+import java.net.URISyntaxException;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.HttpMethods;
+
+public final class HttpMethodsHelper {
+
+    /**
+     * Creates the HttpMethod to use to call the remote server, often either 
its GET or POST.
+     *
+     * @param exchange  the exchange
+     * @return the created method
+     * @throws URISyntaxException
+     */
+    public static HttpMethods createMethod(Exchange exchange, HttpEndpoint 
endpoint, boolean hasPayload) throws URISyntaxException {
+        // compute what method to use either GET or POST
+        HttpMethods answer;
+        HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, 
HttpMethods.class);
+        if (m != null) {
+            // always use what end-user provides in a header
+            answer = m;
+        } else if (hasPayload) {
+            // use POST if we have payload
+            answer = HttpMethods.POST;
+        } else {
+            // fallback to GET
+            answer = HttpMethods.GET;
+        }
+
+        return answer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/java/org/apache/camel/component/http/helper/UrlRewriteHttpServletRequestAdapter.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/UrlRewriteHttpServletRequestAdapter.java
 
b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/UrlRewriteHttpServletRequestAdapter.java
deleted file mode 100644
index d30e865..0000000
--- 
a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/UrlRewriteHttpServletRequestAdapter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.http.helper;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-/**
- * Special adapter when {@link 
org.apache.camel.component.http.HttpServletUrlRewrite} is in use,
- * and the route started from came-jetty/camel-serlvet.
- * <p/>
- * This adapter ensures that we can control the context-path returned from the
- * {@link javax.servlet.http.HttpServletRequest#getContextPath()} method.
- * This allows us to ensure the context-path is based on the endpoint path, as 
the
- * camel-jetty/camel-servlet server implementation uses the root ("/") 
context-path
- * for all the servlets/endpoints.
- */
-public final class UrlRewriteHttpServletRequestAdapter extends 
HttpServletRequestWrapper {
-
-    private final String contextPath;
-
-    /**
-     * Creates this adapter
-     * @param delegate    the real http servlet request to delegate.
-     * @param contextPath use to override and return this context-path
-     */
-    public UrlRewriteHttpServletRequestAdapter(HttpServletRequest delegate, 
String contextPath) {
-        super(delegate);
-        this.contextPath = contextPath;
-    }
-
-
-    public String getContextPath() {
-        return contextPath != null ? contextPath : super.getContextPath();
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
 
b/components/camel-http/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
index db3d92e..96378be 100644
--- 
a/components/camel-http/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ 
b/components/camel-http/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.camel.component.http.HttpConverter
 org.apache.camel.component.http.RequestEntityConverter
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/GoogleUrlRewrite.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/GoogleUrlRewrite.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/GoogleUrlRewrite.java
index 56a223b..807f21a 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/GoogleUrlRewrite.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/GoogleUrlRewrite.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.Producer;
+import org.apache.camel.http.common.UrlRewrite;
 
 // START SNIPPET: e1
 /**

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpAuthMethodPriorityTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpAuthMethodPriorityTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpAuthMethodPriorityTest.java
index 4ea19fb..552b5a0 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpAuthMethodPriorityTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpAuthMethodPriorityTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.http.common.HttpConfiguration;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -45,7 +46,7 @@ public class HttpAuthMethodPriorityTest extends 
CamelTestSupport {
             public void configure() {
                 // setup proxy details
                 HttpConfiguration config = new HttpConfiguration();
-                config.setAuthMethod(AuthMethod.Basic);
+                config.setAuthMethod("Basic");
                 config.setAuthUsername("myUser");
                 config.setAuthPassword("myPassword");
                 // to avoid NTLM

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpConnectionManagerSettingTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpConnectionManagerSettingTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpConnectionManagerSettingTest.java
index 3457508..f77e09f 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpConnectionManagerSettingTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpConnectionManagerSettingTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 import org.junit.Before;
 import org.junit.Test;
+
 import static org.apache.camel.component.http.HttpMethods.POST;
 
 public class HttpConnectionManagerSettingTest extends CamelTestSupport {

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointOptionsNotChangeComponentTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointOptionsNotChangeComponentTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointOptionsNotChangeComponentTest.java
index e1c9201..83db8cc 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointOptionsNotChangeComponentTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpEndpointOptionsNotChangeComponentTest.java
@@ -17,6 +17,8 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.http.common.DefaultHttpBinding;
+import org.apache.camel.http.common.HttpHeaderFilterStrategy;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
index 29e49f3..82a2634 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.http;
 import java.util.List;
 import java.util.Map;
 
-
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.builder.RouteBuilder;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpHeaderFilterStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpHeaderFilterStrategyTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpHeaderFilterStrategyTest.java
index f885fed..4f2ac75 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpHeaderFilterStrategyTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpHeaderFilterStrategyTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.http.common.HttpHeaderFilterStrategy;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.test.junit4.CamelTestSupport;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
index 83f5aac..d0fb60d 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.http.common.HttpOperationFailedException;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
index 8e575dc..886e9c8 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.http;
 import java.io.IOException;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.http.common.HttpOperationFailedException;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.commons.httpclient.HttpMethod;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthBasicTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthBasicTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthBasicTest.java
index 4b230b0..39c5ca2 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthBasicTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthBasicTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.http.common.HttpConfiguration;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -48,7 +49,7 @@ public class HttpProxyAuthBasicTest extends CamelTestSupport {
                 config.setProxyHost("myProxyHosy");
                 config.setProxyPort(1234);
                 // proxy requires auth as well
-                config.setProxyAuthMethod(AuthMethod.Basic);
+                config.setProxyAuthMethod("Basic");
                 config.setProxyAuthUsername("myUser");
                 config.setProxyAuthPassword("myPassword");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthDigestTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthDigestTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthDigestTest.java
index e6c2c4b..f20ae26 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthDigestTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthDigestTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.http.common.HttpConfiguration;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -45,7 +46,7 @@ public class HttpProxyAuthDigestTest extends CamelTestSupport 
{
             public void configure() {
                 // setup proxy details
                 HttpConfiguration config = new HttpConfiguration();
-                config.setProxyAuthMethod(AuthMethod.Digest);
+                config.setProxyAuthMethod("Digest");
                 config.setProxyAuthUsername("myUser");
                 config.setProxyAuthPassword("myPassword");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthNTLMTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthNTLMTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthNTLMTest.java
index 9e5f01c..ba119ae 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthNTLMTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyAuthNTLMTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.http.common.HttpConfiguration;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
@@ -50,7 +51,7 @@ public class HttpProxyAuthNTLMTest extends CamelTestSupport {
                 config.setProxyHost("myProxyHosy");
                 config.setProxyPort(1234);
 
-                config.setProxyAuthMethod(AuthMethod.NTLM);
+                config.setProxyAuthMethod("NTLM");
                 config.setProxyAuthUsername("myUser");
                 config.setProxyAuthPassword("myPassword");
                 config.setProxyAuthDomain("myDomain");

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
index d9e9721..302ca1f 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.http;
 
+import org.apache.camel.http.common.HttpConfiguration;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.URISupport;
 import org.apache.commons.httpclient.HttpClient;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpQueryGoogleProxyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpQueryGoogleProxyTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpQueryGoogleProxyTest.java
index 4ee0101..e1157b2 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpQueryGoogleProxyTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpQueryGoogleProxyTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.http;
 
+import org.apache.camel.http.common.HttpConfiguration;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -35,7 +36,7 @@ public class HttpQueryGoogleProxyTest extends 
CamelTestSupport {
         HttpConfiguration config = new HttpConfiguration();
         config.setProxyHost("myProxyHost");
         config.setProxyPort(8877);
-        config.setProxyAuthMethod(AuthMethod.Basic);
+        config.setProxyAuthMethod("Basic");
         config.setAuthMethodPriority("Digest,Basic");
         config.setProxyAuthUsername("myProxyUsername");
         config.setProxyAuthPassword("myProxyPassword");

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java
index d75d459..5e93ee3 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpReferenceParameterTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.http.common.DefaultHttpBinding;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.commons.httpclient.HttpClient;

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
index 8cd5d16..d8c5a75 100644
--- 
a/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
@@ -27,6 +27,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.component.http.HttpEndpoint;
 import org.apache.camel.component.http.HttpMethods;
+import org.apache.camel.http.common.HttpHelper;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultExchange;
 import org.junit.Test;
@@ -107,46 +108,6 @@ public class HttpHelperTest {
     }
 
     @Test
-    public void createMethodAlwaysUseUserChoosenMethod() throws 
URISyntaxException {
-        HttpMethods method = HttpHelper.createMethod(
-                
createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", 
HttpMethods.POST),
-                createHttpEndpoint(true, "http://www.google.com/search";), 
false);
-        assertEquals(HttpMethods.POST, method);
-    }
-
-    @Test
-    public void createMethodUseGETIfQueryIsProvidedInHeader() throws 
URISyntaxException {
-        HttpMethods method = HttpHelper.createMethod(
-                
createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", null),
-                createHttpEndpoint(true, "http://www.google.com/search";), 
false);
-        assertEquals(HttpMethods.GET, method);
-    }
-
-    @Test
-    public void createMethodUseGETIfQueryIsProvidedInEndpointURI() throws 
URISyntaxException {
-        HttpMethods method = HttpHelper.createMethod(
-                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, 
null),
-                createHttpEndpoint(true, 
"http://www.google.com/search?q=test";), false);
-        assertEquals(HttpMethods.GET, method);
-    }
-
-    @Test
-    public void createMethodUseGETIfNoneQueryOrPayloadIsProvided() throws 
URISyntaxException {
-        HttpMethods method = HttpHelper.createMethod(
-                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, 
null),
-                createHttpEndpoint(true, "http://www.google.com/search";), 
false);
-        assertEquals(HttpMethods.GET, method);
-    }
-
-    @Test
-    public void createMethodUsePOSTIfNoneQueryButPayloadIsProvided() throws 
URISyntaxException {
-        HttpMethods method = HttpHelper.createMethod(
-                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, 
null),
-                createHttpEndpoint(true, "http://www.google.com/search";), 
true);
-        assertEquals(HttpMethods.POST, method);
-    }
-
-    @Test
     public void createURIShouldKeepQueryParametersGivenInUrlParameter() throws 
URISyntaxException {
         URI uri = HttpHelper.createURI(
                 createExchangeWithOptionalCamelHttpUriHeader(null, null),

http://git-wip-us.apache.org/repos/asf/camel/blob/f685f361/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpMethodsHelperTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpMethodsHelperTest.java
 
b/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpMethodsHelperTest.java
new file mode 100644
index 0000000..eab55cb
--- /dev/null
+++ 
b/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpMethodsHelperTest.java
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.http.helper;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.http.HttpEndpoint;
+import org.apache.camel.component.http.HttpMethods;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class HttpMethodsHelperTest {
+
+    @Test
+    public void createMethodAlwaysUseUserChoosenMethod() throws 
URISyntaxException {
+        HttpMethods method = HttpMethodsHelper.createMethod(
+                
createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", 
HttpMethods.POST),
+                createHttpEndpoint(true, "http://www.google.com/search";), 
false);
+        assertEquals(HttpMethods.POST, method);
+    }
+
+    @Test
+    public void createMethodUseGETIfQueryIsProvidedInHeader() throws 
URISyntaxException {
+        HttpMethods method = HttpMethodsHelper.createMethod(
+                
createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", null),
+                createHttpEndpoint(true, "http://www.google.com/search";), 
false);
+        assertEquals(HttpMethods.GET, method);
+    }
+
+    @Test
+    public void createMethodUseGETIfQueryIsProvidedInEndpointURI() throws 
URISyntaxException {
+        HttpMethods method = HttpMethodsHelper.createMethod(
+                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, 
null),
+                createHttpEndpoint(true, 
"http://www.google.com/search?q=test";), false);
+        assertEquals(HttpMethods.GET, method);
+    }
+
+    @Test
+    public void createMethodUseGETIfNoneQueryOrPayloadIsProvided() throws 
URISyntaxException {
+        HttpMethods method = HttpMethodsHelper.createMethod(
+                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, 
null),
+                createHttpEndpoint(true, "http://www.google.com/search";), 
false);
+        assertEquals(HttpMethods.GET, method);
+    }
+
+    @Test
+    public void createMethodUsePOSTIfNoneQueryButPayloadIsProvided() throws 
URISyntaxException {
+        HttpMethods method = HttpMethodsHelper.createMethod(
+                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, 
null),
+                createHttpEndpoint(true, "http://www.google.com/search";), 
true);
+        assertEquals(HttpMethods.POST, method);
+    }
+
+    private Exchange 
createExchangeWithOptionalHttpQueryAndHttpMethodHeader(String httpQuery, 
HttpMethods httpMethod) {
+        CamelContext context = new DefaultCamelContext();
+        Exchange exchange = new DefaultExchange(context);
+        Message inMsg = exchange.getIn();
+        if (httpQuery != null) {
+            inMsg.setHeader(Exchange.HTTP_QUERY, httpQuery);
+        }
+        if (httpMethod != null) {
+            inMsg.setHeader(Exchange.HTTP_METHOD, httpMethod);
+        }
+
+        return exchange;
+    }
+
+    private HttpEndpoint createHttpEndpoint(boolean bridgeEndpoint, String 
endpointURI) throws URISyntaxException {
+        HttpEndpoint endpoint = new HttpEndpoint();
+        endpoint.setBridgeEndpoint(bridgeEndpoint);
+        if (endpointURI != null) {
+            endpoint.setHttpUri(new URI(endpointURI));
+        }
+
+        return endpoint;
+    }
+
+}

Reply via email to