camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r747807 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/converter/jaxp/ camel-core/src/main/java/org/apache/camel/processor/validation/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/ components/camel...
Date Wed, 25 Feb 2009 15:03:59 GMT
Author: davsclaus
Date: Wed Feb 25 15:03:58 2009
New Revision: 747807

URL: http://svn.apache.org/viewvc?rev=747807&view=rev
Log:
CAMEL-1373: Use CamelCase for keys.

Added:
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
  (with props)
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java
  (contents, props changed)
      - copied, changed from r747774, camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/Constants.java
Removed:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/Constants.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.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/HttpHeaderFilterStrategy.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMethods.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.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/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-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestReplyTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
Wed Feb 25 15:03:58 2009
@@ -79,10 +79,9 @@
     private TransformerFactory transformerFactory;
 
     static {
-        // TODO: Use ObjectHelper.loadClass instead
         Class cl = null;
         try {
-            cl = Class.forName("org.apache.xalan.xsltc.trax.DOM2SAX");
+            cl = ObjectHelper.loadClass("org.apache.xalan.xsltc.trax.DOM2SAX");
         } catch (Throwable t) {
             // do nothing here
         }
@@ -184,22 +183,6 @@
     /**
      * Converts the given input Node into text
      */
-/*
-    @Converter
-    public String toString(NodeList nodeList) throws TransformerException {
-        StringWriter buffer = new StringWriter();
-        for (int i = 0, size = nodeList.getLength(); i < size; i++) {
-            Node node = nodeList.item(i);
-            Source source = new DOMSource(node);
-            toResult(source, new StreamResult(buffer));
-        }
-        return buffer.toString();
-    }
-*/
-
-    /**
-     * Converts the given input Node into text
-     */
     @Converter
     public String toString(Node node) throws TransformerException {
         return toString(new DOMSource(node));

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
Wed Feb 25 15:03:58 2009
@@ -145,7 +145,7 @@
     }
 
     protected Source createSchemaSource() throws IOException {
-        throw new IllegalArgumentException("You must specify a schema, schemaFile, schemaSource
or schemaUrl property");
+        throw new IllegalArgumentException("You must specify either a schema, schemaFile,
schemaSource or schemaUrl property");
     }
 
     protected Schema createSchema() throws SAXException, IOException {

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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -83,7 +83,7 @@
 
         if (answer == null) {
             // try http component header
-            answer = camelMessage.getHeader("org.apache.camel.component.http.path", String.class);
+            answer = camelMessage.getHeader("CamelHttpPath", String.class);
         }
         
         return answer;
@@ -104,7 +104,7 @@
 
         if (answer == null) {
             // try http component header
-            answer = camelMessage.getHeader("http.requestMethod", String.class);
+            answer = camelMessage.getHeader("CamelHttpMethod", String.class);
         }
         
         return answer;
@@ -115,8 +115,7 @@
        
         if (answer == null) {
             // try http component header
-            answer = camelMessage.getHeader("org.apache.camel.component.http.characterEncoding",

-                    String.class);
+            answer = camelMessage.getHeader("CamelHttpCharacterEncoding", String.class);
         }
         
         return answer;
@@ -125,22 +124,19 @@
 
     protected String getRequestContentType(org.apache.camel.Message camelMessage) {
         String answer = camelMessage.getHeader(CxfBeanHeaderNames.CONTENT_TYPE, String.class);
-
         if (answer != null) {
             return answer;
         }
         
-        if (answer == null) {
-            // try http component header
-            answer = camelMessage.getHeader("org.apache.camel.component.http.contentType",
String.class);
-        }
-        
+        // try http component header
+        answer = camelMessage.getHeader("CamelHttpContentType", String.class);
+
         if (answer != null) {
             return answer;
         }
         
         // return default
-        return answer = "*/*";
+        return "*/*";
     }
 
 }

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
Wed Feb 25 15:03:58 2009
@@ -56,7 +56,8 @@
             @Override
             public void configure() throws Exception {
                 // START SNIPPET: routeDefinition
-                from("jetty:http://localhost:9000?matchOnUriPrefix=true").to("cxfbean:customerServiceBean");
  
+                from("jetty:http://localhost:9000?matchOnUriPrefix=true").
+                        to("cxfbean:customerServiceBean");
                 // END SNIPPET: routeDefinition
 
             }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
Wed Feb 25 15:03:58 2009
@@ -32,13 +32,6 @@
     private ConcurrentHashMap<String, HttpConsumer> consumers = new ConcurrentHashMap<String,
HttpConsumer>();
     private boolean matchOnUriPrefix;
 
-    /**
-     * @param matchOnUriPrefix the matchOnUriPrefix to set
-     */
-    public void setMatchOnUriPrefix(boolean matchOnUriPrefix) {
-        this.matchOnUriPrefix = matchOnUriPrefix;
-    }
-
     public CamelServlet(boolean matchOnUriPrefix) {
         this.matchOnUriPrefix = matchOnUriPrefix;
     }
@@ -98,5 +91,8 @@
         return matchOnUriPrefix;
     }
     
+    public void setMatchOnUriPrefix(boolean matchOnUriPrefix) {
+        this.matchOnUriPrefix = matchOnUriPrefix;
+    }
 
 }

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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -17,12 +17,9 @@
 package org.apache.camel.component.http;
 
 import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.PrintWriter;
-import java.util.zip.GZIPOutputStream;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
@@ -97,8 +94,8 @@
 
     public void doWriteResponse(Message message, HttpServletResponse response) throws IOException
{
         // set the status code in the response. Default is 200.
-        if (message.getHeader(HttpProducer.HTTP_RESPONSE_CODE) != null) {
-            int code = message.getHeader(HttpProducer.HTTP_RESPONSE_CODE, Integer.class);
+        if (message.getHeader(HttpConstants.HTTP_RESPONSE_CODE) != null) {
+            int code = message.getHeader(HttpConstants.HTTP_RESPONSE_CODE, Integer.class);
             response.setStatus(code);
         }
         // set the content type in the response.
@@ -125,6 +122,7 @@
                 try {
                     ByteArrayOutputStream initialArray = new ByteArrayOutputStream();
                     int c;
+                    // TODO: Use a buffer to write faster instead of looping one char at
a time
                     while ((c = is.read()) >= 0) {
                         initialArray.write(c);
                     }

Added: 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=747807&view=auto
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
(added)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
Wed Feb 25 15:03:58 2009
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+/**
+ * Constants
+ */
+public final class HttpConstants {
+
+    public static final String HTTP_CONTENT_TYPE = "CamelHttpContentType";
+
+    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";
+
+    public static final String HTTP_RESPONSE_CODE = "CamelHttpResponseCode";
+
+    public static final String HTTP_URI = "CamelHttpUri";
+
+    private HttpConstants() {
+        // utility class
+    }
+}

Propchange: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.http;
 
-import org.apache.camel.component.http.helper.GZIPHelper;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
 
 /**
@@ -31,9 +30,9 @@
     protected void initialize() {
         getOutFilter().add("content-length");
         getOutFilter().add("content-type");        
-        getOutFilter().add(HttpMethods.HTTP_METHOD.toLowerCase());
-        getOutFilter().add(HttpProducer.QUERY);
-        getOutFilter().add(HttpProducer.HTTP_RESPONSE_CODE.toLowerCase());
+        getOutFilter().add(HttpConstants.HTTP_METHOD.toLowerCase());
+        getOutFilter().add(HttpConstants.HTTP_QUERY);
+        getOutFilter().add(HttpConstants.HTTP_RESPONSE_CODE.toLowerCase());
         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/HttpMessage.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
Wed Feb 25 15:03:58 2009
@@ -79,11 +79,11 @@
         }
         
         // store the method and query and other info in headers
-        map.put(HttpMethods.HTTP_METHOD, request.getMethod());
-        map.put(HttpProducer.QUERY, request.getQueryString());
-        map.put(HttpProducer.PATH, request.getPathInfo());
-        map.put(HttpProducer.CONTENT_TYPE, request.getContentType());
-        map.put(HttpProducer.CHARACTER_ENCODING, request.getCharacterEncoding());
+        map.put(HttpConstants.HTTP_METHOD, request.getMethod());
+        map.put(HttpConstants.HTTP_QUERY, request.getQueryString());
+        map.put(HttpConstants.HTTP_PATH, request.getPathInfo());
+        map.put(HttpConstants.HTTP_CONTENT_TYPE, request.getContentType());
+        map.put(HttpConstants.HTTP_CHARACTER_ENCODING, request.getCharacterEncoding());
 
     }
 }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMethods.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMethods.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMethods.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMethods.java
Wed Feb 25 15:03:58 2009
@@ -34,8 +34,6 @@
     GET(GetMethod.class), POST(PostMethod.class), PUT(PutMethod.class), DELETE(DeleteMethod.class),
HEAD(
         HeadMethod.class), OPTIONS(OptionsMethod.class), TRACE(TraceMethod.class);
 
-    public static final String HTTP_METHOD = "http.requestMethod";
-
     final Class<? extends HttpMethod> clazz;
     final boolean entity;
 

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
Wed Feb 25 15:03:58 2009
@@ -63,9 +63,12 @@
             // lets store the result in the output message.
             LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream();
             InputStream is = method.getResponseBodyAsStream();
-            IOUtils.copy(is, bos);
-            bos.flush();
-            is.close();
+            try {
+                IOUtils.copy(is, bos);
+                bos.flush();
+            } finally {
+                is.close();
+            }
             Message message = exchange.getIn();
             message.setBody(bos.createInputStream());
 
@@ -80,7 +83,7 @@
                 }
             }
         
-            message.setHeader("http.responseCode", responseCode);
+            message.setHeader(HttpConstants.HTTP_RESPONSE_CODE, responseCode);
             return exchange;
         } catch (IOException e) {
             throw new RuntimeCamelException(e);

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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -39,19 +39,10 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import static org.apache.camel.component.http.HttpMethods.HTTP_METHOD;
-
 /**
  * @version $Revision$
  */
 public class HttpProducer extends DefaultProducer {
-    public static final String HTTP_URI = "http.uri";
-    public static final String HTTP_RESPONSE_CODE = "http.responseCode";
-    public static final String QUERY = "org.apache.camel.component.http.query";    
-    public static final String PATH = "org.apache.camel.component.http.path";  
-    public static final String CONTENT_TYPE = "org.apache.camel.component.http.contentType";
-    public static final String CHARACTER_ENCODING = "org.apache.camel.component.http.characterEncoding";
-
     private static final transient Log LOG = LogFactory.getLog(HttpProducer.class);
     private HttpClient httpClient;
 
@@ -87,7 +78,7 @@
                 Message answer = exchange.getOut(true);
 
                 answer.setHeaders(in.getHeaders());
-                answer.setHeader(HTTP_RESPONSE_CODE, responseCode);
+                answer.setHeader(HttpConstants.HTTP_RESPONSE_CODE, responseCode);
                 answer.setBody(extractResponseBody(method));
 
                 // propagate HTTP response headers
@@ -173,7 +164,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(QUERY, String.class);
+        String queryString = exchange.getIn().getHeader(HttpConstants.HTTP_QUERY, String.class);
         if (queryString == null) {
             queryString = ((HttpEndpoint)getEndpoint()).getHttpUri().getQuery();
         }
@@ -181,7 +172,7 @@
 
         // compute what method to use either GET or POST
         HttpMethods methodToUse;
-        HttpMethods m = exchange.getIn().getHeader(HTTP_METHOD, HttpMethods.class);
+        HttpMethods m = exchange.getIn().getHeader(HttpConstants.HTTP_METHOD, HttpMethods.class);
         if (m != null) {
             // always use what end-user provides in a header
             methodToUse = m;
@@ -193,7 +184,7 @@
             methodToUse = requestEntity != null ? HttpMethods.POST : HttpMethods.GET;
         }
 
-        String uri = exchange.getIn().getHeader(HTTP_URI, String.class);
+        String uri = exchange.getIn().getHeader(HttpConstants.HTTP_URI, String.class);
         if (uri == null) {
             uri = ((HttpEndpoint)getEndpoint()).getHttpUri().toString();
         }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/RequestEntityConverter.java
Wed Feb 25 15:03:58 2009
@@ -16,64 +16,53 @@
  */
 package org.apache.camel.component.http;
 
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
-import java.util.zip.GZIPOutputStream;
-
-import javax.servlet.ServletInputStream;
 
 import org.apache.camel.Converter;
 import org.apache.camel.Exchange;
-import org.apache.camel.Message;
 import org.apache.camel.component.http.helper.GZIPHelper;
 import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
 import org.apache.commons.httpclient.methods.RequestEntity;
 
-
-
 /**
  * Some converter methods to make it easier to convert the body to RequestEntity types.
- * 
  */
-
 @Converter
 public class RequestEntityConverter {
 
     @Converter
     public RequestEntity toRequestEntity(ByteBuffer buffer, Exchange exchange) throws Exception
{
         return new InputStreamRequestEntity(
-               GZIPHelper.toGZIPInputStreamIfRequested(
-                   (String) exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING),
-                   buffer.array()));
-    } 
+                GZIPHelper.toGZIPInputStreamIfRequested(
+                        exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING, String.class),
+                        buffer.array()));
+    }
 
     @Converter
     public RequestEntity toRequestEntity(byte[] array, Exchange exchange) throws Exception
{
         return new InputStreamRequestEntity(
-               GZIPHelper.toGZIPInputStreamIfRequested(
-                   (String) exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING),
-                   array));
-    } 
+                GZIPHelper.toGZIPInputStreamIfRequested(
+                        exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING, String.class),
+                        array));
+    }
 
     @Converter
     public RequestEntity toRequestEntity(InputStream inStream, Exchange exchange) throws
Exception {
         return new InputStreamRequestEntity(
-               GZIPHelper.getGZIPWrappedInputStream(
-                    (String) exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING),
-                    inStream));
-    } 
+                GZIPHelper.getGZIPWrappedInputStream(
+                        exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING, String.class),
+                        inStream));
+    }
 
 
     @Converter
     public RequestEntity toRequestEntity(String str, Exchange exchange) throws Exception
{
         return new InputStreamRequestEntity(
-               GZIPHelper.toGZIPInputStreamIfRequested(
-                   (String) exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING),
-                   str.getBytes()));
-    } 
+                GZIPHelper.toGZIPInputStreamIfRequested(
+                        exchange.getIn().getHeader(GZIPHelper.CONTENT_ENCODING, String.class),
+                        str.getBytes()));
+    }
 
 
 }

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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -61,7 +61,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HttpProducer.QUERY, constant("hl=en&q=activemq"))
+                from("direct:start").setHeader(HttpConstants.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/HttpInvalidConfigurationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInvalidConfigurationTest.java?rev=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -20,7 +20,6 @@
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.builder.RouteBuilder;
 
-import static org.apache.camel.component.http.HttpMethods.HTTP_METHOD;
 import static org.apache.camel.component.http.HttpMethods.POST;
 
 /**
@@ -44,7 +43,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HTTP_METHOD, POST).to("http://http://www.google.com");
+                from("direct:start").setHeader(HttpConstants.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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -20,7 +20,6 @@
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.builder.RouteBuilder;
 
-import static org.apache.camel.component.http.HttpMethods.HTTP_METHOD;
 import static org.apache.camel.component.http.HttpMethods.POST;
 
 /**
@@ -44,7 +43,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HTTP_METHOD, POST).to("http://www.google.com?httpClient.xxx=true");
+                from("direct:start").setHeader(HttpConstants.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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -28,7 +28,6 @@
 import org.apache.camel.component.mock.MockEndpoint;
 
 import static org.apache.camel.component.http.HttpMethods.GET;
-import static org.apache.camel.component.http.HttpMethods.HTTP_METHOD;
 import static org.apache.camel.component.http.HttpMethods.POST;
 
 
@@ -104,10 +103,10 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("direct:start").setHeader(HTTP_METHOD, POST).to("http://www.google.com");
-                from("direct:reset").setHeader(HTTP_METHOD, POST).
+                from("direct:start").setHeader(HttpConstants.HTTP_METHOD, POST).to("http://www.google.com");
+                from("direct:reset").setHeader(HttpConstants.HTTP_METHOD, POST).
                     errorHandler(deadLetterChannel("direct:recovery").maximumRedeliveries(1)).to("http://www.google.com").to("mock:result");
-                from("direct:recovery").setHeader(HTTP_METHOD, GET).to("http://www.google.com").to("mock:recovery");
+                from("direct:recovery").setHeader(HttpConstants.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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -22,7 +22,6 @@
 import org.apache.commons.httpclient.HttpMethod;
 
 import static org.apache.camel.component.http.HttpMethods.GET;
-import static org.apache.camel.component.http.HttpMethods.HTTP_METHOD;
 import static org.apache.camel.component.http.HttpMethods.POST;
 
 /**
@@ -72,7 +71,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HTTP_METHOD, POST);
+        exchange.getIn().setHeader(HttpConstants.HTTP_METHOD, POST);
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");
@@ -90,7 +89,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HTTP_METHOD, GET);
+        exchange.getIn().setHeader(HttpConstants.HTTP_METHOD, GET);
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");
@@ -125,7 +124,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HttpProducer.QUERY, "q=Camel");
+        exchange.getIn().setHeader(HttpConstants.HTTP_QUERY, "q=Camel");
         try {
             producer.process(exchange);
             fail("Should have thrown HttpOperationFailedException");
@@ -143,7 +142,7 @@
 
         HttpExchange exchange = (HttpExchange) producer.createExchange();
         exchange.getIn().setBody("");
-        exchange.getIn().setHeader(HttpProducer.QUERY, "q=Camel");
+        exchange.getIn().setHeader(HttpConstants.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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -18,8 +18,7 @@
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.http.HttpMethods;
-import org.apache.camel.component.http.HttpProducer;
+import org.apache.camel.component.http.HttpConstants;
 import org.apache.camel.component.mock.MockEndpoint;
 
 /**
@@ -33,7 +32,7 @@
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedHeaderReceived("one", "einz");
         mock.expectedHeaderReceived("two", "twei");
-        mock.expectedHeaderReceived(HttpMethods.HTTP_METHOD, "GET");
+        mock.expectedHeaderReceived(HttpConstants.HTTP_METHOD, "GET");
 
         template.sendBody(serverUri + "?one=einz&two=twei", null);
 
@@ -44,9 +43,9 @@
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedHeaderReceived("one", "uno");
         mock.expectedHeaderReceived("two", "dos");
-        mock.expectedHeaderReceived(HttpMethods.HTTP_METHOD, "GET");
+        mock.expectedHeaderReceived(HttpConstants.HTTP_METHOD, "GET");
 
-        template.sendBodyAndHeader(serverUri, null, HttpProducer.QUERY, "one=uno&two=dos");
+        template.sendBodyAndHeader(serverUri, null, HttpConstants.HTTP_QUERY, "one=uno&two=dos");
 
         assertMockEndpointsSatisfied();
     }
@@ -54,7 +53,7 @@
     public void testHttpPost() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedBodiesReceived("Hello World");
-        mock.expectedHeaderReceived(HttpMethods.HTTP_METHOD, "POST");
+        mock.expectedHeaderReceived(HttpConstants.HTTP_METHOD, "POST");
 
         template.sendBody(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=747807&r1=747806&r2=747807&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
Wed Feb 25 15:03:58 2009
@@ -21,8 +21,8 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.http.HttpConstants;
 import org.apache.camel.component.http.HttpExchange;
-import org.apache.camel.component.http.HttpProducer;
 import org.apache.camel.component.mock.MockEndpoint;
 
 /**
@@ -50,7 +50,7 @@
         mock.expectedHeaderReceived("one", "einz");
         mock.expectedHeaderReceived("two", "twei");
 
-        template.sendBodyAndHeader(serverUri, "Hello World", HttpProducer.QUERY, "one=uno&two=dos");
+        template.sendBodyAndHeader(serverUri, "Hello World", HttpConstants.HTTP_QUERY, "one=uno&two=dos");
 
         assertMockEndpointsSatisfied();
     }

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java
Wed Feb 25 15:03:58 2009
@@ -104,7 +104,7 @@
         JmsExchange exchange = new JmsExchange(endpoint, endpoint.getExchangePattern(), getBinding(),
message);
         // lets set to an InOut if we have some kind of reply-to destination
         if (replyDestination != null && !disableReplyTo) {
-            exchange.setProperty(Constants.JMS_REPLY_DESTINATION, replyDestination);
+            exchange.setProperty(JmsConstants.JMS_REPLY_DESTINATION, replyDestination);
             exchange.setPattern(ExchangePattern.InOut);
         }
         return exchange;

Copied: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java
(from r747774, camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/Constants.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java?p2=camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java&p1=camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/Constants.java&r1=747774&r2=747807&rev=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/Constants.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java
Wed Feb 25 15:03:58 2009
@@ -19,11 +19,11 @@
 /**
  * Constants
  */
-public final class Constants {
+public final class JmsConstants {
 
     public static final String JMS_REPLY_DESTINATION = "CamelJmsReplyDestination";
 
-    private Constants() {
+    private JmsConstants() {
         // utility class
     }
 

Propchange: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestReplyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestReplyTest.java?rev=747807&r1=747806&r2=747807&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestReplyTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestReplyTest.java
Wed Feb 25 15:03:58 2009
@@ -70,7 +70,7 @@
                     public void process(Exchange exchange) throws Exception {
                         exchange.getIn().setBody("Bye World");
                         // the reply destination is set as a property on the exchange while
we process it
-                        assertNotNull(exchange.getProperty(Constants.JMS_REPLY_DESTINATION));
+                        assertNotNull(exchange.getProperty(JmsConstants.JMS_REPLY_DESTINATION));
                     }
                 }).to("mock:result");
             }



Mime
View raw message