servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tt...@apache.org
Subject svn commit: r533084 - in /incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http: ./ processors/
Date Fri, 27 Apr 2007 13:00:20 GMT
Author: tterm
Date: Fri Apr 27 06:00:19 2007
New Revision: 533084

URL: http://svn.apache.org/viewvc?view=rev&rev=533084
Log:
SM-795 HTTP headers attached as properties may cause requests to fail

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/ConsumerProcessor.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?view=diff&rev=533084&r1=533083&r2=533084
==============================================================================
--- 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
Fri Apr 27 06:00:19 2007
@@ -119,6 +119,13 @@
     private int proxyPort;
 
     /**
+     * This field is used to decide if the http prover processor can copy the http headers
from the http response
+     * into the exchange as property. Be careful if the headers will be used for a new http
reuquest, it leads to an
+     * error.
+     */
+    private boolean wantHeadersFromHttpIntoExchange;
+
+    /**
      * @return Returns the rootDir.
      * @org.apache.xbean.Property hidden="true"
      */
@@ -362,6 +369,23 @@
         save();
     }
 
+    /**
+     *
+     * @return Returns the it the http headers will be copied into the exchange
+     */
+    public boolean isWantHeadersFromHttpIntoExchange() {
+        return wantHeadersFromHttpIntoExchange;
+    }
+
+    /**
+     *
+     * @param wantHeadersFromHttpIntoExchange true if the headers should be copied into the
exchange
+     */
+    public void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange)
{
+        this.wantHeadersFromHttpIntoExchange = wantHeadersFromHttpIntoExchange;
+    }
+
+
     public void save() {
         setProperty(componentName + ".jettyThreadPoolSize", Integer.toString(jettyThreadPoolSize));
         setProperty(componentName + ".jettyConnectorClassName", jettyConnectorClassName);
@@ -376,6 +400,7 @@
         setProperty(componentName + ".retryCount", Integer.toString(retryCount));
         setProperty(componentName + ".proxyHost", proxyHost);
         setProperty(componentName + ".proxyPort", Integer.toString(proxyPort));
+        setProperty(componentName + ".wantHeadersFromHttpIntoExchange", Boolean.toString(wantHeadersFromHttpIntoExchange));
         if (rootDir != null) {
             File f = new File(rootDir, CONFIG_FILE);
             try {
@@ -459,6 +484,10 @@
         }
         if (properties.getProperty(componentName + ".proxyPort") != null) {
             proxyPort = Integer.parseInt(properties.getProperty(componentName + ".proxyPort"));
+        }
+        if (properties.getProperty(componentName + ".wantHeadersFromHttpIntoExchange") !=
null) {
+            wantHeadersFromHttpIntoExchange =
+                    Boolean.valueOf(properties.getProperty(componentName + ".wantHeadersFromHttpIntoExchange")).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?view=diff&rev=533084&r1=533083&r2=533084
==============================================================================
--- 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
Fri Apr 27 06:00:19 2007
@@ -70,4 +70,8 @@
 
     void setProxyPort(int name);
 
+    boolean isWantHeadersFromHttpIntoExchange();
+
+    void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange);
+    
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?view=diff&rev=533084&r1=533083&r2=533084
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Fri Apr 27 06:00:19 2007
@@ -149,7 +149,9 @@
                 request.setAttribute(Context.class.getName(), ctx);
                 exchange = soapHelper.onReceive(ctx);
                 NormalizedMessage inMessage = exchange.getMessage("in");
-                inMessage.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(request));
+                if (getConfiguration().isWantHeadersFromHttpIntoExchange()) {
+                    inMessage.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(request));
+                }
                 locks.put(exchange.getExchangeId(), cont);
                 request.setAttribute(MessageExchange.class.getName(), exchange.getExchangeId());
                 synchronized (cont) {

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?view=diff&rev=533084&r1=533083&r2=533084
==============================================================================
--- 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
Fri Apr 27 06:00:19 2007
@@ -216,7 +216,9 @@
                                       method.getResponseHeader(HEADER_CONTENT_TYPE).getValue());
             context.setOutMessage(soapMessage);
             soapHelper.onAnswer(context);
-            msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
+            if (getConfiguration().isWantHeadersFromHttpIntoExchange()) {
+                msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
+            }
             soapHelper.getJBIMarshaler().toNMS(msg, soapMessage);
             ((InOptionalOut) exchange).setOutMessage(msg);
             if (txSync) {
@@ -238,7 +240,9 @@
         SoapMessage soapMessage = reader.read(method.getResponseBodyAsStream(), contentType
!= null ? contentType.getValue() : null);
         context.setOutMessage(soapMessage);
         soapHelper.onAnswer(context);
-        msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
+        if (getConfiguration().isWantHeadersFromHttpIntoExchange()) {
+            msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
+        }
         soapHelper.getJBIMarshaler().toNMS(msg, soapMessage);
         ((InOut) exchange).setOutMessage(msg);
         if (txSync) {



Mime
View raw message