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 13:46:10 UTC

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

Author: tterm
Date: Thu Oct  4 04:46:09 2007
New Revision: 581863

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

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

Modified: incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java?rev=581863&r1=581862&r2=581863&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java Thu Oct  4 04:46:09 2007
@@ -125,6 +125,8 @@
      */
     private boolean wantHeadersFromHttpIntoExchange;
 
+    private boolean wantContentTypeHeaderFromExchangeIntoHttpRequest;
+
     /**
      * @return Returns the rootDir.
      * @org.apache.xbean.Property hidden="true"
@@ -384,7 +386,23 @@
     public void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange) {
         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));
         setProperty(componentName + ".jettyConnectorClassName", jettyConnectorClassName);
@@ -400,6 +418,7 @@
         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 {
@@ -487,6 +506,10 @@
         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/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java?rev=581863&r1=581862&r2=581863&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfigurationMBean.java Thu Oct  4 04:46:09 2007
@@ -74,4 +74,8 @@
 
     void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange);
 
+    boolean isWantContentTypeHeaderFromExchangeIntoHttpRequest();
+
+    void setWantContentTypeHeaderFromExchangeIntoHttpRequest(boolean wantContentTypeHeaderFromExchangeIntoHttpRequest);
+
 }

Modified: incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?rev=581863&r1=581862&r2=581863&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java Thu Oct  4 04:46:09 2007
@@ -141,8 +141,11 @@
         }
         RequestEntity entity = writeMessage(writer);
         // remove content-type header that may have been part of the in message
-        method.removeRequestHeader(Constants.HEADER_CONTENT_TYPE);
-        method.addRequestHeader(Constants.HEADER_CONTENT_TYPE, entity.getContentType());
+        if (!getConfiguration().isWantContentTypeHeaderFromExchangeIntoHttpRequest())
+        {
+            method.removeRequestHeader(Constants.HEADER_CONTENT_TYPE);
+            method.addRequestHeader(Constants.HEADER_CONTENT_TYPE, entity.getContentType());
+        }
         if (entity.getContentLength() < 0) {
             method.removeRequestHeader(Constants.HEADER_CONTENT_LENGTH);
         } else {