camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r774806 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/ components/camel-cxf/src/mai...
Date Thu, 14 May 2009 15:14:12 GMT
Author: ningjiang
Date: Thu May 14 15:14:12 2009
New Revision: 774806

URL: http://svn.apache.org/viewvc?rev=774806&view=rev
Log:
CAMEL-1594 Set the content-type in the camel-restlet and camel-cxf

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportConstants.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
    camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
    camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithPathHeaderTest.java
    camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidConfigurationTest.java
    camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidHttpClientConfigurationTest.java
    camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
    camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Thu May 14 15:14:12
2009
@@ -34,6 +34,10 @@
     String CONTENT_TYPE = "CamelConentType";
     String HTTP_RESPONSE_CODE = "CamelHttpResponseCode";
     String HTTP_URI = "CamelHttpUri";
+    String HTTP_QUERY = "CamelHttpQuery";
+    String HTTP_METHOD = "CamelHttpMethod";
+    String HTTP_PATH = "CamelHttpPath";
+    String HTTP_CHARACTER_ENCODING = "CamelHttpCharacterEncoding";
 
     String BEAN_METHOD_NAME = "CamelBeanMethodName";
     String BEAN_HOLDER = "CamelBeanHolder";

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java
Thu May 14 15:14:12 2009
@@ -66,7 +66,7 @@
         // Since CXF can take the content-type from the protocol header
         // we need to filter this header of this name.
         getOutFilter().add("content-type");
-                        
+                                
         // initialize message header filter map with default SOAP filter
         messageHeaderFiltersMap = new HashMap<String, MessageHeaderFilter>();
         addToMessageHeaderFilterMap(new SoapMessageHeaderFilter());

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanHeaderNames.java
Thu May 14 15:14:12 2009
@@ -16,15 +16,17 @@
  */
 package org.apache.camel.component.cxf.cxfbean;
 
+import org.apache.camel.Exchange;
+
 /**
  * @version $Revision$
  */
 public interface CxfBeanHeaderNames {
     
-    String VERB = "CamelCxfBeanVerb";
-    String CONTENT_TYPE = "CamelCxfBeanContentType";
-    String CHARACTER_ENCODING = "CamelCxfBeanCharacterEncoding";
-    String PATH = "CamelCxfBeanRequestPath";
+    String VERB = Exchange.HTTP_METHOD;
+    String CONTENT_TYPE = Exchange.CONTENT_TYPE;
+    String CHARACTER_ENCODING = Exchange.HTTP_CHARACTER_ENCODING;
+    String PATH = Exchange.HTTP_PATH;
     String BASE_PATH = "CamelCxfBeanRequestBasePath";
 
 }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
Thu May 14 15:14:12 2009
@@ -80,12 +80,6 @@
 
     protected String getPath(org.apache.camel.Message camelMessage) {
         String answer = camelMessage.getHeader(CxfBeanHeaderNames.PATH, String.class);
-
-        if (answer == null) {
-            // try http component header
-            answer = camelMessage.getHeader("CamelHttpPath", String.class);
-        }
-        
         return answer;
     }
     
@@ -101,23 +95,14 @@
 
     protected String getVerb(org.apache.camel.Message camelMessage) {
         String answer = camelMessage.getHeader(CxfBeanHeaderNames.VERB, String.class);
-
-        if (answer == null) {
-            // try http component header
-            answer = camelMessage.getHeader("CamelHttpMethod", String.class);
-        }
-        
         return answer;
     }
 
     protected String getCharacterEncoding(org.apache.camel.Message camelMessage) {
         String answer = camelMessage.getHeader(CxfBeanHeaderNames.CHARACTER_ENCODING, String.class);
-       
         if (answer == null) {
-            // try http component header
-            answer = camelMessage.getHeader("CamelHttpCharacterEncoding", String.class);
+            answer = camelMessage.getHeader(Exchange.CHARSET_NAME, String.class);
         }
-        
         return answer;
 
     }
@@ -126,15 +111,7 @@
         String answer = camelMessage.getHeader(CxfBeanHeaderNames.CONTENT_TYPE, String.class);
         if (answer != null) {
             return answer;
-        }
-        
-        // try http component header
-        answer = camelMessage.getHeader("CamelHttpContentType", String.class);
-
-        if (answer != null) {
-            return answer;
-        }
-        
+        }        
         // return default
         return "*/*";
     }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportConstants.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportConstants.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportConstants.java
Thu May 14 15:14:12 2009
@@ -45,8 +45,7 @@
     public static final String CAMEL_CLIENT_CONFIG_ID = "camel-template";
     public static final String CAMEL_SERVER_CONFIG_ID = "camel-server";
     public static final String CAMEL_REBASED_REPLY_TO = "org.apache.cxf.camel.server.replyto";
-    public static final String CAMEL_CORRELATION_ID = "org.apache.cxf.camel.correlationId";
-    public static final String CAMEL_CONTENT_TYPE = "CamelConentType";
+    public static final String CAMEL_CORRELATION_ID = "org.apache.cxf.camel.correlationId";
  
     
     private CamelTransportConstants() {
         // Utility class

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
Thu May 14 15:14:12 2009
@@ -64,7 +64,7 @@
             if (strategy != null
                     && !strategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(),
exchange)) {
 
-                if (CamelTransportConstants.CAMEL_CONTENT_TYPE.equals(entry.getKey())) {
+                if (Exchange.CONTENT_TYPE.equals(entry.getKey())) {
                     message.put(Message.CONTENT_TYPE, entry.getValue());
                 } else if (Client.REQUEST_CONTEXT.equals(entry.getKey())
                             || Client.RESPONSE_CONTEXT.equals(entry.getKey())
@@ -101,7 +101,7 @@
         String key = Message.CONTENT_TYPE;
         Object value = message.get(key);
         if (value != null && !strategy.applyFilterToExternalHeaders(key, value, exchange))
{
-            headers.put(CamelTransportConstants.CAMEL_CONTENT_TYPE, value);
+            headers.put(Exchange.CONTENT_TYPE, value);
         }
 
         // propagate request context

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
Thu May 14 15:14:12 2009
@@ -23,6 +23,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.util.MessageHelper;
 
 public class CxfRawMessageRouterTest extends CxfSimpleRouterTest {
     private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS +
"&dataFormat=MESSAGE";
@@ -60,8 +61,8 @@
             }
 
         });
-        assertNotNull("We should get the Content-Type here", exchange.getOut().getHeader("Content-Type"));
-        assertEquals("Get wrong content type", "text/xml; charset=utf-8", exchange.getOut().getHeader("Content-Type"));
+        assertNotNull("We should get the Content-Type here", MessageHelper.getContentType(exchange.getOut()));
+        assertEquals("Get wrong content type", "text/xml; charset=utf-8", MessageHelper.getContentType(exchange.getOut()));
         assertNull("We should not get the content-type here", exchange.getOut().getHeader("content-type"));
       
         String response = exchange.getOut().getBody(String.class);        
         assertNotNull("Response should not be null", response);

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
Thu May 14 15:14:12 2009
@@ -85,11 +85,11 @@
         }
         
         // store the method and query and other info in headers
-        headers.put(HttpConstants.HTTP_METHOD, request.getMethod());
-        headers.put(HttpConstants.HTTP_QUERY, request.getQueryString());
-        headers.put(HttpConstants.HTTP_PATH, request.getPathInfo());
+        headers.put(Exchange.HTTP_METHOD, request.getMethod());
+        headers.put(Exchange.HTTP_QUERY, request.getQueryString());
+        headers.put(Exchange.HTTP_PATH, request.getPathInfo());
         headers.put(Exchange.CONTENT_TYPE, request.getContentType());
-        headers.put(HttpConstants.HTTP_CHARACTER_ENCODING, request.getCharacterEncoding());
+        headers.put(Exchange.HTTP_CHARACTER_ENCODING, request.getCharacterEncoding());
         
     }
 

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
Thu May 14 15:14:12 2009
@@ -21,14 +21,6 @@
  */
 public final class HttpConstants {    
 
-    public static final String HTTP_CHARACTER_ENCODING = "CamelHttpCharacterEncoding";
-
-    public static final String HTTP_METHOD = "CamelHttpMethod";
-
-    public static final String HTTP_PATH = "CamelHttpPath";
-
-    public static final String HTTP_QUERY = "CamelHttpQuery";
-
     private HttpConstants() {
         // utility class
     }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpHeaderFilterStrategy.java
Thu May 14 15:14:12 2009
@@ -31,8 +31,6 @@
     protected void initialize() {
         getOutFilter().add("content-length");
         getOutFilter().add("content-type");
-        getOutFilter().add(HttpConstants.HTTP_METHOD.toLowerCase());
-        getOutFilter().add(HttpConstants.HTTP_QUERY);        
         setLowerCase(true);
         
         // filter headers begin with "Camel" or "org.apache.camel"

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
Thu May 14 15:14:12 2009
@@ -180,7 +180,7 @@
      */
     protected HttpMethod createMethod(Exchange exchange) {
         // is a query string provided in the endpoint URI or in a header (header overrules
endpoint)
-        String queryString = exchange.getIn().getHeader(HttpConstants.HTTP_QUERY, String.class);
+        String queryString = exchange.getIn().getHeader(Exchange.HTTP_QUERY, String.class);
         if (queryString == null) {
             queryString = ((HttpEndpoint)getEndpoint()).getHttpUri().getQuery();
         }
@@ -188,7 +188,7 @@
 
         // compute what method to use either GET or POST
         HttpMethods methodToUse;
-        HttpMethods m = exchange.getIn().getHeader(HttpConstants.HTTP_METHOD, HttpMethods.class);
+        HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, HttpMethods.class);
         if (m != null) {
             // always use what end-user provides in a header
             methodToUse = m;
@@ -206,7 +206,7 @@
         }
 
         // append HTTP_PATH to HTTP_URI if it is provided in the header
-        String path = exchange.getIn().getHeader(HttpConstants.HTTP_PATH, String.class);
+        String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
         if (path != null) {
             // make sure that there is exactly one "/" between HTTP_URI and HTTP_PATH
             if (!uri.endsWith("/")) {

Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
(original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetTest.java
Thu May 14 15:14:12 2009
@@ -61,7 +61,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HttpConstants.HTTP_QUERY, constant("hl=en&q=activemq"))
+                from("direct:start").setHeader(Exchange.HTTP_QUERY, constant("hl=en&q=activemq"))
                     .to("http://www.google.com/search").to("mock:results");
             }
         };

Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithPathHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithPathHeaderTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithPathHeaderTest.java
(original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpGetWithPathHeaderTest.java
Thu May 14 15:14:12 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.http;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 
 /**
@@ -28,8 +29,8 @@
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .setHeader(HttpConstants.HTTP_PATH, constant("search"))
-                    .setHeader(HttpConstants.HTTP_QUERY, constant("hl=en&q=activemq"))
+                    .setHeader(Exchange.HTTP_PATH, constant("search"))
+                    .setHeader(Exchange.HTTP_QUERY, constant("hl=en&q=activemq"))
                     .to("http://www.google.com").to("mock:results");
             }
         };

Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidConfigurationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidConfigurationTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidConfigurationTest.java
(original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidConfigurationTest.java
Thu May 14 15:14:12 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.builder.RouteBuilder;
 
@@ -43,7 +44,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HttpConstants.HTTP_METHOD, POST).to("http://http://www.google.com");
+                from("direct:start").setHeader(Exchange.HTTP_METHOD, POST).to("http://http://www.google.com");
             }
         };
     }

Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidHttpClientConfigurationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidHttpClientConfigurationTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidHttpClientConfigurationTest.java
(original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidHttpClientConfigurationTest.java
Thu May 14 15:14:12 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.component.http;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.builder.RouteBuilder;
 
@@ -43,7 +44,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HttpConstants.HTTP_METHOD, POST).to("http://www.google.com?httpClient.xxx=true");
+                from("direct:start").setHeader(Exchange.HTTP_METHOD, POST).to("http://www.google.com?httpClient.xxx=true");
             }
         };
     }

Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
(original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpPostWithBodyTest.java
Thu May 14 15:14:12 2009
@@ -103,10 +103,10 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HttpConstants.HTTP_METHOD, POST).to("http://www.google.com");
-                from("direct:reset").setHeader(HttpConstants.HTTP_METHOD, POST).
+                from("direct:start").setHeader(Exchange.HTTP_METHOD, POST).to("http://www.google.com");
+                from("direct:reset").setHeader(Exchange.HTTP_METHOD, POST).
                     errorHandler(deadLetterChannel("direct:recovery").maximumRedeliveries(1)).to("http://www.google.com").to("mock:result");
-                from("direct:recovery").setHeader(HttpConstants.HTTP_METHOD, GET).to("http://www.google.com").to("mock:recovery");
+                from("direct:recovery").setHeader(Exchange.HTTP_METHOD, GET).to("http://www.google.com").to("mock:recovery");
             }
         };
     }

Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
(original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProducerSelectMethodTest.java
Thu May 14 15:14:12 2009
@@ -19,6 +19,7 @@
 import java.io.IOException;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
 import org.apache.commons.httpclient.HttpMethod;
 
 import static org.apache.camel.component.http.HttpMethods.GET;
@@ -71,7 +72,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HttpConstants.HTTP_METHOD, POST);
+        exchange.getIn().setHeader(Exchange.HTTP_METHOD, POST);
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");
@@ -89,7 +90,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HttpConstants.HTTP_METHOD, GET);
+        exchange.getIn().setHeader(Exchange.HTTP_METHOD, GET);
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");
@@ -124,7 +125,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HttpConstants.HTTP_QUERY, "q=Camel");
+        exchange.getIn().setHeader(Exchange.HTTP_QUERY, "q=Camel");
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");
@@ -142,7 +143,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HttpConstants.HTTP_QUERY, "q=Camel");
+        exchange.getIn().setHeader(Exchange.HTTP_QUERY, "q=Camel");
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
Thu May 14 15:14:12 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.component.jetty;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.http.HttpConstants;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -32,7 +33,7 @@
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedHeaderReceived("one", "einz");
         mock.expectedHeaderReceived("two", "twei");
-        mock.expectedHeaderReceived(HttpConstants.HTTP_METHOD, "GET");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
 
         template.requestBody(serverUri + "?one=einz&two=twei", null, Object.class);
 
@@ -43,9 +44,9 @@
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedHeaderReceived("one", "uno");
         mock.expectedHeaderReceived("two", "dos");
-        mock.expectedHeaderReceived(HttpConstants.HTTP_METHOD, "GET");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "GET");
 
-        template.requestBodyAndHeader(serverUri, null, HttpConstants.HTTP_QUERY, "one=uno&two=dos");
+        template.requestBodyAndHeader(serverUri, null, Exchange.HTTP_QUERY, "one=uno&two=dos");
 
         assertMockEndpointsSatisfied();
     }
@@ -53,7 +54,7 @@
     public void testHttpPost() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedBodiesReceived("Hello World");
-        mock.expectedHeaderReceived(HttpConstants.HTTP_METHOD, "POST");
+        mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
 
         template.requestBody(serverUri, "Hello World");
 

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
Thu May 14 15:14:12 2009
@@ -50,7 +50,7 @@
         mock.expectedHeaderReceived("one", "einz");
         mock.expectedHeaderReceived("two", "twei");
 
-        template.requestBodyAndHeader(serverUri, "Hello World", HttpConstants.HTTP_QUERY,
"one=uno&two=dos");
+        template.requestBodyAndHeader(serverUri, "Hello World", Exchange.HTTP_QUERY, "one=uno&two=dos");
 
         assertMockEndpointsSatisfied();
     }

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java?rev=774806&r1=774805&r2=774806&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java
(original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java
Thu May 14 15:14:12 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.restlet;
 
+import org.apache.camel.Exchange;
+
 /**
  * Constants for Restlet component
  * 
@@ -25,9 +27,9 @@
     
     public static final String RESTLET_LOGIN = "CamelRestletLogin";
     public static final String RESTLET_PASSWORD = "CamelRestletPassword";
-    public static final String RESTLET_MEDIA_TYPE = "CamelRestletMediaType";
-    public static final String RESTLET_RESPONSE_CODE = "CamelRestletResponseCode";
-    public static final String RESTLET_QUERY_STRING = "CamelRestletQueryString";
+    public static final String RESTLET_MEDIA_TYPE = Exchange.CONTENT_TYPE;
+    public static final String RESTLET_RESPONSE_CODE = Exchange.HTTP_RESPONSE_CODE;
+    public static final String RESTLET_QUERY_STRING = Exchange.HTTP_QUERY;
 
     private RestletConstants() {
     }



Mime
View raw message