servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tt...@apache.org
Subject svn commit: r678365 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http: HttpEndpoint.java processors/ProviderProcessor.java
Date Mon, 21 Jul 2008 08:53:36 GMT
Author: tterm
Date: Mon Jul 21 01:53:35 2008
New Revision: 678365

URL: http://svn.apache.org/viewvc?rev=678365&view=rev
Log:
Preserving or configuring content-type of http-header

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java?rev=678365&r1=678364&r2=678365&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
Mon Jul 21 01:53:35 2008
@@ -61,6 +61,7 @@
     protected boolean synchronous;
     protected boolean wantContentTypeHeaderFromExchangeIntoHttpRequest;
     protected int timeout;
+    protected String overrideContentTypeHeader;
 
     public boolean isWantContentTypeHeaderFromExchangeIntoHttpRequest() {
         return wantContentTypeHeaderFromExchangeIntoHttpRequest;
@@ -70,6 +71,14 @@
         this.wantContentTypeHeaderFromExchangeIntoHttpRequest = wantContentTypeHeaderFromExchangeIntoHttpRequest;
     }
 
+    public String getOverrideContentTypeHeader() {
+        return overrideContentTypeHeader;
+    }
+
+    public void setOverrideContentTypeHeader(String overrideContentTypeHeader) {
+        this.overrideContentTypeHeader = overrideContentTypeHeader;
+    }
+
     /**
      * @return the synchronous
      */

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?rev=678365&r1=678364&r2=678365&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Mon Jul 21 01:53:35 2008
@@ -96,6 +96,13 @@
         return relUri;
     }
 
+    private void overrideContentType(PostMethod method) {
+        if (endpoint.getOverrideContentTypeHeader() != null) {
+            method.removeRequestHeader(HEADER_CONTENT_TYPE);
+            method.addRequestHeader(HEADER_CONTENT_TYPE, "\"" + endpoint.getOverrideContentTypeHeader()
+ "\"");
+        }
+    }
+
     public void process(MessageExchange exchange) throws Exception {
         if (exchange.getStatus() == ExchangeStatus.DONE || exchange.getStatus() == ExchangeStatus.ERROR)
{
             PostMethod method = methods.remove(exchange.getExchangeId());
@@ -133,6 +140,8 @@
             method.removeRequestHeader(HEADER_CONTENT_TYPE);
             method.addRequestHeader(HEADER_CONTENT_TYPE, entity.getContentType());
         }
+         // override content-type header
+        overrideContentType(method);
         if (entity.getContentLength() < 0) {
             method.removeRequestHeader(HEADER_CONTENT_LENGTH);
         } else {



Mime
View raw message