camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r682597 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/processor/interceptor/ components/camel-cxf/src/main/java/org/apache/ca...
Date Tue, 05 Aug 2008 06:36:30 GMT
Author: ningjiang
Date: Mon Aug  4 23:36:26 2008
New Revision: 682597

URL: http://svn.apache.org/viewvc?rev=682597&view=rev
Log:
CAMEL-766 applied the patch with thanks to William

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java   (with props)
    activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java   (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Debugger.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapComponent.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
    activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
    activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java
    activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcEndpoint.java
    activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcProducer.java
    activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
    activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java Mon Aug  4 23:36:26 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.camel;
 
-import org.apache.camel.spi.HeaderFilterStrategy;
-
 /**
  * A <a href="http://activemq.apache.org/camel/component.html">component</a> is
  * a factory of {@link Endpoint} objects.
@@ -49,14 +47,4 @@
      */
     Endpoint<E> createEndpoint(String uri) throws Exception;
     
-    
-    /**
-     * @return strategy object that handles header filter for this component.
-     */
-    HeaderFilterStrategy getHeaderFilterStrategy();
-    
-    /**
-     * Sets strategy object that handles header filtering for this component.
-     */
-    void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy);
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java Mon Aug  4 23:36:26 2008
@@ -18,8 +18,6 @@
 
 import java.util.Map;
 
-import org.apache.camel.spi.HeaderFilterStrategy;
-
 /**
  * An <a href="http://activemq.apache.org/camel/endpoint.html">endpoint</a>
  * implements the <a
@@ -109,11 +107,6 @@
     void configureProperties(Map options);
 
     void setCamelContext(CamelContext context);
-    
-    /**
-     * @return the header propagation strategy
-     */
-    HeaderFilterStrategy getHeaderFilterStrategy();
 
     @Deprecated
     CamelContext getContext();

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java?rev=682597&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java Mon Aug  4 23:36:26 2008
@@ -0,0 +1,33 @@
+/**
+ * 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;
+
+import org.apache.camel.spi.HeaderFilterStrategy;
+
+/**
+ * An interface to represent an object which can make use of
+ * injected {@link HeaderFilterStrategy}.
+ * 
+ * @since 1.5
+ * @version $Revision$
+ */
+public interface HeaderFilterStrategyAware {
+
+    HeaderFilterStrategy getHeaderFilterStrategy();
+    
+    void setHeaderFilterStrategy(HeaderFilterStrategy strategy);
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/HeaderFilterStrategyAware.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java Mon Aug  4 23:36:26 2008
@@ -27,7 +27,6 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
@@ -48,8 +47,7 @@
     private int defaultThreadPoolSize = 5;
     private CamelContext camelContext;
     private ScheduledExecutorService executorService;
-    private HeaderFilterStrategy headerFilterStrategy = new DefaultHeaderFilterStrategy();
-
+    
     public DefaultComponent() {
     }
 
@@ -141,14 +139,6 @@
     public void setExecutorService(ScheduledExecutorService executorService) {
         this.executorService = executorService;
     }
-
-    public HeaderFilterStrategy getHeaderFilterStrategy() {
-        return headerFilterStrategy;
-    }
-    
-    public void setHeaderFilterStrategy(HeaderFilterStrategy value) {
-        headerFilterStrategy = value;
-    }
     
     /**
      * A factory method to create a default thread pool and executor

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java Mon Aug  4 23:36:26 2008
@@ -29,7 +29,6 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.PollingConsumer;
-import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -199,11 +198,6 @@
         this.endpointUri = endpointUri;
     }
     
-    public HeaderFilterStrategy getHeaderFilterStrategy() {
-        return component.getHeaderFilterStrategy();
-    }
-
-    
     @Deprecated
     public CamelContext getContext() {
         return getCamelContext();

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Debugger.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Debugger.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Debugger.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Debugger.java Mon Aug  4 23:36:26 2008
@@ -85,7 +85,7 @@
     public void setEnable(boolean flag) {
         enabled = flag;
         tracer.setEnabled(flag);
-        for(DebugInterceptor interceptor : interceptors.values()) {
+        for (DebugInterceptor interceptor : interceptors.values()) {
             interceptor.setEnabled(flag);
         }
     }
@@ -122,7 +122,7 @@
     public Processor wrapProcessorInInterceptors(ProcessorType processorType, Processor target) throws Exception {
         String id = processorType.idOrCreate();
         if (logExchanges) {
-            TraceInterceptor  traceInterceptor= new TraceInterceptor(processorType, target, tracer);
+            TraceInterceptor  traceInterceptor = new TraceInterceptor(processorType, target, tracer);
             target = traceInterceptor;
         }
         DebugInterceptor interceptor = new DebugInterceptor(processorType, target, createExchangeList(), createExceptionsList());

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java Mon Aug  4 23:36:26 2008
@@ -24,6 +24,7 @@
 import java.util.logging.Logger;
 
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.component.cxf.util.CxfHeaderHelper;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.frontend.MethodDispatcher;
@@ -162,6 +163,9 @@
         } else {
             cxfExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, m.getName());
         }
+        
+        CxfHeaderHelper.propagateCxfToCamel(endpoint.getHeaderFilterStrategy(), exchange.getInMessage(), 
+                cxfExchange.getIn().getHeaders());
         cxfExchange.getIn().setBody(params);
         try {
             cxfConsumer.getProcessor().process(cxfExchange);

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java Mon Aug  4 23:36:26 2008
@@ -22,6 +22,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.camel.component.cxf.util.CxfHeaderHelper;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
@@ -54,17 +56,24 @@
         return null;
     }
 
+    /**
+     * @deprecated please use {@link #createCxfMessage(HeaderFilterStrategy, CxfExchange)} instead
+     */
     public static Message createCxfMessage(CxfExchange exchange) {
+        return CxfBinding.createCxfMessage(new CxfHeaderFilterStrategy(), exchange);
+    }
+    
+    public static Message createCxfMessage(HeaderFilterStrategy strategy, CxfExchange exchange) {
+
         Message answer = exchange.getInMessage();
         CxfMessage in = exchange.getIn();
+        
         // Check the body if the POJO parameter list first
         Object body = in.getBody(List.class);
         if (body instanceof List) {
             // just set the operation's parameter
             answer.setContent(List.class, body);
-            // just set the method name
-            answer.put(CxfConstants.OPERATION_NAME, (String)in.getHeader(CxfConstants.OPERATION_NAME));
-            answer.put(CxfConstants.OPERATION_NAMESPACE, (String)in.getHeader(CxfConstants.OPERATION_NAMESPACE));
+            CxfHeaderHelper.propagateCamelToCxf(strategy, in.getHeaders(), answer);
         } else {
             // CXF uses StAX which is based on the stream API to parse the XML,
             // so the CXF transport is also based on the stream API.
@@ -74,15 +83,24 @@
             if (body instanceof InputStream) {
                 answer.setContent(InputStream.class, body);
             }
+            // TODO do we propagate header the same way in non-POJO mode?
+            // CxfHeaderHelper.propagateCamelToCxf(strategy, in.getHeaders(), answer);
         }
         return answer;
     }
 
-    // Store
+    /**
+     * @deprecated please use {@link #storeCxfResponse(HeaderFilterStrategy, CxfExchange, Message)} instead.
+     */
     public static void storeCxfResponse(CxfExchange exchange, Message response) {
-        // no need to process headers as we use the CXF message
+        CxfBinding.storeCxfResponse(new CxfHeaderFilterStrategy(), exchange, response);
+    }
+    
+    public static void storeCxfResponse(HeaderFilterStrategy strategy, CxfExchange exchange, 
+            Message response) {
         CxfMessage out = exchange.getOut();
         if (response != null) {
+            CxfHeaderHelper.propagateCxfToCamel(strategy, response, out.getHeaders());
             out.setMessage(response);
             DataFormat dataFormat = (DataFormat) exchange.getProperty(CxfExchange.DATA_FORMAT);
             if (dataFormat.equals(DataFormat.MESSAGE)) {
@@ -94,9 +112,19 @@
         }
     }
 
-    // Copy the Camel message to CXF message
+    /**
+     * @deprecated Please use {@link #copyMessage(HeaderFilterStrategy, org.apache.camel.Message, Message)} instead.
+     */
     public static void copyMessage(org.apache.camel.Message camelMessage, org.apache.cxf.message.Message cxfMessage) {
+        CxfBinding.copyMessage(new CxfHeaderFilterStrategy(), camelMessage, cxfMessage);
+    }
+    
+    // Copy the Camel message to CXF message
+    public static void copyMessage(HeaderFilterStrategy strategy, 
+            org.apache.camel.Message camelMessage, org.apache.cxf.message.Message cxfMessage) {
         InputStream is = camelMessage.getBody(InputStream.class);
+        
+        CxfHeaderHelper.propagateCamelToCxf(strategy, camelMessage.getHeaders(), cxfMessage);
         if (is != null) {
             cxfMessage.setContent(InputStream.class, is);
         } else {
@@ -117,7 +145,7 @@
             response.put(Client.RESPONSE_CONTEXT, context);
         }
     }
-
+    
     public static void storeCxfResponse(CxfExchange exchange, Object response) {
         CxfMessage out = exchange.getOut();
         if (response != null) {
@@ -152,4 +180,5 @@
         return responseContext;
 
     }
+
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java Mon Aug  4 23:36:26 2008
@@ -20,7 +20,9 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.HeaderFilterStrategy;
 
 
 /**
@@ -28,9 +30,11 @@
 
  * @version $Revision$
  */
-public class CxfComponent extends DefaultComponent<CxfExchange> {
+public class CxfComponent extends DefaultComponent<CxfExchange> implements HeaderFilterStrategyAware {
 
 
+    private HeaderFilterStrategy headerFilterStrategy = new CxfHeaderFilterStrategy();
+
     public CxfComponent() {
     }
 
@@ -47,5 +51,13 @@
         return result;
     }
 
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
+        headerFilterStrategy = strategy;
+    }
+
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Aug  4 23:36:26 2008
@@ -22,6 +22,7 @@
 import org.apache.camel.Producer;
 import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.cxf.configuration.spring.ConfigurerImpl;
 import org.apache.cxf.message.Message;
@@ -192,5 +193,8 @@
         }
     }
 
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return component.getHeaderFilterStrategy();
+    }
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java Mon Aug  4 23:36:26 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.cxf;
 
-import java.util.Map;
-
 import org.apache.camel.impl.DefaultMessage;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
@@ -84,21 +82,7 @@
     public void setMessage(Message cxfMessage) {
         this.cxfMessage = cxfMessage;
     }
-
-    public Object getHeader(String name) {
-        return cxfMessage.get(name);
-    }
-
-    @Override
-    public void setHeader(String name, Object value) {
-        cxfMessage.put(name, value);
-    }
-
-    @Override
-    public Map<String, Object> getHeaders() {
-        return cxfMessage;
-    }
-
+    
     @Override
     public CxfMessage newInstance() {
         return new CxfMessage();

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Mon Aug  4 23:36:26 2008
@@ -179,7 +179,7 @@
     }
 
     public void process(CxfExchange exchange) {
-        Message inMessage = CxfBinding.createCxfMessage(exchange);
+        Message inMessage = CxfBinding.createCxfMessage(endpoint.getHeaderFilterStrategy(), exchange);
         exchange.setProperty(CxfExchange.DATA_FORMAT, dataFormat);
         try {
             if (dataFormat.equals(DataFormat.POJO)) {
@@ -189,8 +189,8 @@
                 if (parameters == null) {
                     parameters = new ArrayList();
                 }
-                String operationName = (String)inMessage.get(CxfConstants.OPERATION_NAME);
-                String operationNameSpace = (String)inMessage.get(CxfConstants.OPERATION_NAMESPACE);
+                String operationName = exchange.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
+                String operationNameSpace = exchange.getIn().getHeader(CxfConstants.OPERATION_NAMESPACE, String.class);
                 // Get context from message
                 Map<String, Object> context = new HashMap<String, Object>();
                 Map<String, Object> responseContext = CxfBinding.propogateContext(inMessage, context);
@@ -204,7 +204,7 @@
                         response.setContent(Object[].class, result);
                         // copy the response context to the response
                         CxfBinding.storeCXfResponseContext(response, responseContext);
-                        CxfBinding.storeCxfResponse(exchange, response);
+                        CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(), exchange, response);
                     } catch (Exception ex) {
                         response.setContent(Exception.class, ex);
                         CxfBinding.storeCxfFault(exchange, response);
@@ -253,7 +253,7 @@
                     invokingContext.setResponseContent(response, result);
                     // copy the response context to the response
                     CxfBinding.storeCXfResponseContext(response, responseContext);
-                    CxfBinding.storeCxfResponse(exchange, response);
+                    CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(), exchange, response);
                 } catch (Exception e) {
                     response.setContent(Exception.class, e);
                     CxfBinding.storeCxfFault(exchange, response);

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapComponent.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapComponent.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapComponent.java Mon Aug  4 23:36:26 2008
@@ -19,7 +19,9 @@
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.URISupport;
@@ -30,7 +32,9 @@
  *
  * @version $Revision$
  */
-public class CxfSoapComponent extends DefaultComponent {
+public class CxfSoapComponent extends DefaultComponent implements HeaderFilterStrategyAware {
+
+    private HeaderFilterStrategy headerFilterStrategy;
 
     public CxfSoapComponent() {
         setHeaderFilterStrategy(new CxfHeaderFilterStrategy());
@@ -54,4 +58,13 @@
         return false;
     }
 
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
+        headerFilterStrategy = strategy;
+        
+    }
+
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java Mon Aug  4 23:36:26 2008
@@ -23,6 +23,7 @@
 
 import org.apache.camel.component.cxf.transport.CamelTransportConstants;
 import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
 
@@ -64,6 +65,9 @@
 
                 if (CamelTransportConstants.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())) {
+                    message.put(entry.getKey(), entry.getValue());
                 } else {
                     List<String> listValue = new ArrayList<String>();
                     listValue.add(entry.getValue().toString());
@@ -71,30 +75,45 @@
                 }
             }
         }
-
     }
 
-
     public static void propagateCxfToCamel(HeaderFilterStrategy strategy,
             Message message, Map<String, Object> headers) {
 
+        if (strategy == null) {
+            return;
+        }
+
         Map<String, List<String>> cxfHeaders =
             CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
 
         if (cxfHeaders != null) {
             for (Map.Entry<String, List<String>> entry : cxfHeaders.entrySet()) {
-                if (strategy != null
-                        && !strategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue())) {
+                if (!strategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue())) {
                     headers.put(entry.getKey(), entry.getValue().get(0));
                 }
             }
         }
 
-        String contentType = (String) message.get(Message.CONTENT_TYPE);
-        if (contentType != null && strategy != null
-                && !strategy.applyFilterToExternalHeaders(Message.CONTENT_TYPE, contentType)) {
-            headers.put(CamelTransportConstants.CONTENT_TYPE, contentType);
+        // propagate content type
+        String key = Message.CONTENT_TYPE;
+        Object value = message.get(key);
+        if (value != null && !strategy.applyFilterToExternalHeaders(key, value)) {
+            headers.put(CamelTransportConstants.CONTENT_TYPE, value);
         }
 
+        // propagate request context
+        key = Client.REQUEST_CONTEXT;
+        value = message.get(key);
+        if (value != null && !strategy.applyFilterToExternalHeaders(key, value)) {
+            headers.put(key, value);
+        }
+
+        // propagate response context
+        key = Client.RESPONSE_CONTEXT;
+        value = message.get(key);
+        if (value != null && !strategy.applyFilterToExternalHeaders(key, value)) {
+            headers.put(key, value);
+        }
     }
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java Mon Aug  4 23:36:26 2008
@@ -86,7 +86,6 @@
 
 
     public void testInvokingSimpleServerWithParams() throws Exception {
-
         CxfExchange exchange = sendSimpleMessage();
 
         org.apache.camel.Message out = exchange.getOut();
@@ -96,6 +95,7 @@
         assertNotNull(responseContext);
         assertEquals("We should get the response context here", "UTF-8", responseContext.get(org.apache.cxf.message.Message.ENCODING));
         assertEquals("reply body on Camel", "echo " + TEST_MESSAGE, output[0]);
+
     }
 
 

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Mon Aug  4 23:36:26 2008
@@ -20,8 +20,10 @@
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.commons.httpclient.HttpConnectionManager;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
@@ -33,12 +35,14 @@
  *
  * @version $Revision$
  */
-public class HttpComponent extends DefaultComponent<HttpExchange> {
+public class HttpComponent extends DefaultComponent<HttpExchange> implements HeaderFilterStrategyAware {
 
     private HttpClientConfigurer httpClientConfigurer;
 
     private HttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
 
+    private HeaderFilterStrategy headerFilterStrategy;
+
     public HttpComponent() {
         this.setHeaderFilterStrategy(new HttpHeaderFilterStrategy());
     }
@@ -96,4 +100,13 @@
     protected boolean useIntrospectionOnEndpoint() {
         return false;
     }
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
+        headerFilterStrategy = strategy;
+        
+    }
 }

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java Mon Aug  4 23:36:26 2008
@@ -26,6 +26,7 @@
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultPollingEndpoint;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpConnectionManager;
 import org.apache.commons.httpclient.params.HttpClientParams;
@@ -141,6 +142,10 @@
         return binding;
     }
 
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return component.getHeaderFilterStrategy();
+    }
+
     public void setBinding(HttpBinding binding) {
         this.binding = binding;
     }

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java Mon Aug  4 23:36:26 2008
@@ -70,7 +70,7 @@
 
             // lets set the headers
             Header[] headers = method.getResponseHeaders();
-            HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();
+            HeaderFilterStrategy strategy = endpoint.getHeaderFilterStrategy();
             for (Header header : headers) {
                 String name = header.getName();
                 String value = header.getValue();

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java Mon Aug  4 23:36:26 2008
@@ -63,7 +63,7 @@
         HttpMethod method = createMethod(exchange);
         Message in = exchange.getIn();
         HttpBinding binding = ((HttpEndpoint)getEndpoint()).getBinding();
-        HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();
+        HeaderFilterStrategy strategy = ((HttpEndpoint)getEndpoint()).getHeaderFilterStrategy();
 
         // propagate headers as HTTP headers
         for (String headerName : in.getHeaders().keySet()) {

Modified: activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java (original)
+++ activemq/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java Mon Aug  4 23:36:26 2008
@@ -129,7 +129,7 @@
         }
 
         // propagate headers to http request
-        HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();
+        HeaderFilterStrategy strategy = ((HttpEndpoint)getEndpoint()).getHeaderFilterStrategy();
         for (String name : in.getHeaders().keySet()) {
             String value = in.getHeader(name, String.class);
             if ("Content-Type".equals(name)) {

Modified: activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java (original)
+++ activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java Mon Aug  4 23:36:26 2008
@@ -20,8 +20,10 @@
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.params.BasicHttpParams;
@@ -29,24 +31,17 @@
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
 
-public class JhcComponent extends DefaultComponent<JhcExchange> {
+public class JhcComponent extends DefaultComponent<JhcExchange> implements HeaderFilterStrategyAware {
 
     private static final Log LOG = LogFactory.getLog(JhcComponent.class);
 
     private HttpParams params;
 
+    private HeaderFilterStrategy headerFilterStrategy;
+
     public JhcComponent() {
-        // We could import filters from http component but that also means
-        // a new dependency on camel-http
-        DefaultHeaderFilterStrategy strategy = new DefaultHeaderFilterStrategy();
-        strategy.getOutFilter().add("content-length");
-        strategy.getOutFilter().add("content-type");
-        strategy.getOutFilter().add(JhcProducer.HTTP_RESPONSE_CODE);
-        strategy.setIsLowercase(true);
-
-        // filter headers begin with "org.apache.camel"
-        strategy.setOutFilterPattern("(org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");        
-        setHeaderFilterStrategy(strategy);
+     
+        setHeaderFilterStrategy(new JhcHeaderFilterStrategy());
         
         params = new BasicHttpParams(null)
             .setIntParameter(HttpConnectionParams.SO_TIMEOUT, 5000)
@@ -69,4 +64,12 @@
         return new JhcEndpoint(uri, this, new URI(uri.substring(uri.indexOf(':') + 1)));
     }
 
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
+        headerFilterStrategy = strategy;
+    }
+
 }

Modified: activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcEndpoint.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcEndpoint.java Mon Aug  4 23:36:26 2008
@@ -19,9 +19,11 @@
 import java.net.URI;
 
 import org.apache.camel.Consumer;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 
@@ -99,4 +101,12 @@
     public Consumer<JhcExchange> createConsumer(Processor processor) throws Exception {
         return new JhcConsumer(this, processor);
     }
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        if (getComponent() instanceof HeaderFilterStrategyAware) {
+            return ((HeaderFilterStrategyAware)getComponent()).getHeaderFilterStrategy();
+        } else {
+            return new JhcHeaderFilterStrategy();
+        }
+    }
 }

Added: activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java?rev=682597&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java (added)
+++ activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java Mon Aug  4 23:36:26 2008
@@ -0,0 +1,42 @@
+/**
+ * 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.jhc;
+
+import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class JhcHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
+
+    public JhcHeaderFilterStrategy() {
+        initialize();
+    }
+    
+    protected void initialize() {
+        // We could import filters from http component but that also means
+        // a new dependency on camel-http
+        getOutFilter().add("content-length");
+        getOutFilter().add("content-type");
+        getOutFilter().add(JhcProducer.HTTP_RESPONSE_CODE);
+        setIsLowercase(true);
+
+        // filter headers begin with "org.apache.camel"
+        setOutFilterPattern("(org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");   
+    }
+}

Propchange: activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcHeaderFilterStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcProducer.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcProducer.java (original)
+++ activemq/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcProducer.java Mon Aug  4 23:36:26 2008
@@ -157,7 +157,7 @@
         }
 
         // propagate headers as HTTP headers
-        HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();
+        HeaderFilterStrategy strategy = ((JhcEndpoint)getEndpoint()).getHeaderFilterStrategy();
         for (String headerName : exchange.getIn().getHeaders().keySet()) {
             String headerValue = exchange.getIn().getHeader(headerName, String.class);
             if (strategy != null && !strategy.applyFilterToCamelHeaders(headerName, headerValue)) {

Modified: activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java Mon Aug  4 23:36:26 2008
@@ -24,8 +24,10 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.component.jms.requestor.Requestor;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -47,7 +49,8 @@
  *
  * @version $Revision:520964 $
  */
-public class JmsComponent extends DefaultComponent<JmsExchange> implements ApplicationContextAware {
+public class JmsComponent extends DefaultComponent<JmsExchange> implements ApplicationContextAware,
+    HeaderFilterStrategyAware {
 
     private static final transient Log LOG = LogFactory.getLog(JmsComponent.class);
     private static final String DEFAULT_QUEUE_BROWSE_STRATEGY = "org.apache.camel.component.jms.DefaultQueueBrowseStrategy";
@@ -56,6 +59,7 @@
     private Requestor requestor;
     private QueueBrowseStrategy queueBrowseStrategy;
     private boolean attemptedToCreateQueueBrowserStrategy;
+    private HeaderFilterStrategy headerFilterStrategy;
 
     public JmsComponent() {
         setHeaderFilterStrategy(new JmsHeaderFilterStrategy());
@@ -445,4 +449,13 @@
             return (QueueBrowseStrategy)ObjectHelper.newInstance(type);
         }
     }
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
+        this.headerFilterStrategy = strategy;
+        
+    }
 }

Modified: activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java Mon Aug  4 23:36:26 2008
@@ -21,10 +21,12 @@
 import javax.jms.TemporaryTopic;
 
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.HeaderFilterStrategyAware;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.component.jms.requestor.Requestor;
 import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.HeaderFilterStrategy;
 import org.springframework.jms.core.JmsOperations;
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.listener.AbstractMessageListenerContainer;
@@ -258,4 +260,13 @@
             }
         }
     }
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        if (getComponent() instanceof HeaderFilterStrategyAware) {
+            return ((HeaderFilterStrategyAware)getComponent()).getHeaderFilterStrategy();
+        } else {
+            return new JmsHeaderFilterStrategy();
+        }
+    }
+
 }

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java?rev=682597&r1=682596&r2=682597&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java Mon Aug  4 23:36:26 2008
@@ -76,15 +76,13 @@
         camelContext.addComponent(componentName, jmsComponentClientAcknowledge(connectionFactory));
 
         // add "testheader" to in filter set
-        ((DefaultHeaderFilterStrategy)camelContext.getComponent(componentName)
-                .getHeaderFilterStrategy()).getInFilter().add("testheader");
+        JmsComponent component = (JmsComponent)camelContext.getComponent(componentName);
+        ((DefaultHeaderFilterStrategy)component.getHeaderFilterStrategy()).getInFilter().add("testheader");
         // add "anotherheader" to out filter set
-        ((DefaultHeaderFilterStrategy)camelContext.getComponent(componentName)
-                .getHeaderFilterStrategy()).getOutFilter().add("anotherheader");
+        ((DefaultHeaderFilterStrategy)component.getHeaderFilterStrategy()).getOutFilter().add("anotherheader");
         // add a regular expression pattern filter
         // notice that dots are encoded to underscores in jms headers
-        ((DefaultHeaderFilterStrategy)camelContext.getComponent(componentName)
-                .getHeaderFilterStrategy()).setInFilterPattern(IN_FILTER_PATTERN);
+        ((DefaultHeaderFilterStrategy)component.getHeaderFilterStrategy()).setInFilterPattern(IN_FILTER_PATTERN);
 
         return camelContext;
     }



Mime
View raw message