You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by tt...@apache.org on 2007/10/04 14:39:06 UTC

svn commit: r581878 - in /incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http: HttpConfiguration.java HttpConfigurationMBean.java processors/ProviderProcessor.java

Author: tterm
Date: Thu Oct  4 05:39:05 2007
New Revision: 581878

URL: http://svn.apache.org/viewvc?rev=581878&view=rev
Log:
SM-1084 make configurable if CONTENT-TYPE is used as property from the normalized message or not

Modified:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java?rev=581878&r1=581877&r2=581878&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java Thu Oct  4 05:39:05 2007
@@ -125,6 +125,8 @@
      */
     private boolean wantHeadersFromHttpIntoExchange;
 
+    private boolean wantContentTypeHeaderFromExchangeIntoHttpRequest;
+
     /**
      * @return Returns the rootDir.
      * @org.apache.xbean.Property hidden="true"
@@ -385,6 +387,21 @@
         this.wantHeadersFromHttpIntoExchange = wantHeadersFromHttpIntoExchange;
     }
 
+     /**
+     *
+     * @return
+     */
+    public boolean isWantContentTypeHeaderFromExchangeIntoHttpRequest() {
+        return wantContentTypeHeaderFromExchangeIntoHttpRequest;
+    }
+
+    /**
+     *
+     * @param wantContentTypeHeaderFromExchangeIntoHttpRequest
+     */
+    public void setWantContentTypeHeaderFromExchangeIntoHttpRequest(boolean wantContentTypeHeaderFromExchangeIntoHttpRequest) {
+        this.wantContentTypeHeaderFromExchangeIntoHttpRequest = wantContentTypeHeaderFromExchangeIntoHttpRequest;
+    }
 
     public void save() {
         setProperty(componentName + ".jettyThreadPoolSize", Integer.toString(jettyThreadPoolSize));
@@ -401,6 +418,8 @@
         setProperty(componentName + ".proxyHost", proxyHost);
         setProperty(componentName + ".proxyPort", Integer.toString(proxyPort));
         setProperty(componentName + ".wantHeadersFromHttpIntoExchange", Boolean.toString(wantHeadersFromHttpIntoExchange));
+        setProperty(componentName + ".wantContentTypeHeaderFromExchangeIntoHttpRequest",
+                Boolean.toString(wantContentTypeHeaderFromExchangeIntoHttpRequest));
         if (rootDir != null) {
             File f = new File(rootDir, CONFIG_FILE);
             try {
@@ -488,6 +507,11 @@
         if (properties.getProperty(componentName + ".wantHeadersFromHttpIntoExchange") != null) {
             wantHeadersFromHttpIntoExchange =
                     Boolean.valueOf(properties.getProperty(componentName + ".wantHeadersFromHttpIntoExchange")).booleanValue();
+        }
+        if (properties.getProperty(componentName + ".wantContentTypeHeaderFromExchangeIntoHttpRequest") != null) {
+            wantContentTypeHeaderFromExchangeIntoHttpRequest =
+                    Boolean.valueOf(properties.getProperty(componentName
+                            + ".wantContentTypeHeaderFromExchangeIntoHttpRequest")).booleanValue();
         }
         return true;
     }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java?rev=581878&r1=581877&r2=581878&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java Thu Oct  4 05:39:05 2007
@@ -73,5 +73,8 @@
     boolean isWantHeadersFromHttpIntoExchange();
 
     void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange);
-    
+
+    boolean isWantContentTypeHeaderFromExchangeIntoHttpRequest();
+
+    void setWantContentTypeHeaderFromExchangeIntoHttpRequest(boolean wantContentTypeHeaderFromExchangeIntoHttpRequest);
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?rev=581878&r1=581877&r2=581878&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java Thu Oct  4 05:39:05 2007
@@ -129,8 +129,10 @@
         copyHeaderInformation(nm, method);
         RequestEntity entity = writeMessage(writer);
         // remove content-type header that may have been part of the in message
-        method.removeRequestHeader(HEADER_CONTENT_TYPE);
-        method.addRequestHeader(HEADER_CONTENT_TYPE, entity.getContentType());
+        if (!getConfiguration().isWantContentTypeHeaderFromExchangeIntoHttpRequest()) {
+            method.removeRequestHeader(HEADER_CONTENT_TYPE);
+            method.addRequestHeader(HEADER_CONTENT_TYPE, entity.getContentType());
+        }
         if (entity.getContentLength() < 0) {
             method.removeRequestHeader(HEADER_CONTENT_LENGTH);
         } else {