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 2011/01/21 16:55:20 UTC
svn commit: r1061864 - in
/servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http:
HttpComponent.java HttpConfiguration.java
Author: tterm
Date: Fri Jan 21 15:55:20 2011
New Revision: 1061864
URL: http://svn.apache.org/viewvc?rev=1061864&view=rev
Log:
SMXCOMP-844 Possibility to choose preemptive Authentication for the http provider endpoint.
Modified:
servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java
servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
Modified: servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java?rev=1061864&r1=1061863&r2=1061864&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java Fri Jan 21 15:55:20 2011
@@ -257,6 +257,8 @@ public class HttpComponent extends Defau
params.setMaxTotalConnections(configuration.getMaxTotalConnections());
connectionManager.setParams(params);
client = new HttpClient(connectionManager);
+ client.getParams().setAuthenticationPreemptive(configuration.isPreemptiveAuthentication());
+
}
// Create connectionPool
if (connectionPool == null) {
Modified: servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java?rev=1061864&r1=1061863&r2=1061864&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/HttpConfiguration.java Fri Jan 21 15:55:20 2011
@@ -151,6 +151,12 @@ public class HttpConfiguration implement
private boolean wantHeadersFromHttpIntoExchange;
/**
+ * This field is used to decide if the http provider processor http client should use preemptive authentication
+ * which avoids in case of true the double sending of requests.
+ */
+ private boolean preemptiveAuthentication;
+
+ /**
* @return Returns the rootDir.
* @org.apache.xbean.Property hidden="true"
*/
@@ -663,6 +669,23 @@ public class HttpConfiguration implement
this.wantHeadersFromHttpIntoExchange = wantHeadersFromHttpIntoExchange;
}
+ /**
+ *
+ * @return true if preemptive auth is used in the http client
+ */
+ public boolean isPreemptiveAuthentication() {
+ return preemptiveAuthentication;
+ }
+
+ /**
+ *
+ * @param preemptiveAuthentication the value which strategy should be used
+ */
+ public void setPreemptiveAuthentication(boolean preemptiveAuthentication) {
+ this.preemptiveAuthentication = preemptiveAuthentication;
+ save();
+ }
+
public void save() {
setProperty(componentName + ".jettyThreadPoolSize", Integer.toString(jettyThreadPoolSize));
setProperty(componentName + ".jettyClientThreadPoolSize", Integer.toString(jettyClientThreadPoolSize));
@@ -684,6 +707,7 @@ public class HttpConfiguration implement
setProperty(componentName + ".proxyPort", Integer.toString(proxyPort));
setProperty(componentName + ".wantHeadersFromHttpIntoExchange", Boolean
.toString(wantHeadersFromHttpIntoExchange));
+ setProperty(componentName + ".preemptiveAuthentication", Boolean.toString(preemptiveAuthentication));
if (rootDir != null) {
File f = new File(rootDir, CONFIG_FILE);
try {
@@ -739,10 +763,8 @@ public class HttpConfiguration implement
.getProperty(componentName + ".jettyClientThreadPoolSize"));
}
if (properties.getProperty(componentName + ".jettyClientPerProvider") != null) {
- jettyClientPerProvider = Boolean.valueOf(
- properties.getProperty(componentName
- + ".jettyClientPerProvider"))
- .booleanValue();
+ jettyClientPerProvider = Boolean.valueOf(properties.getProperty(componentName + ".jettyClientPerProvider"))
+ .booleanValue();
}
if (properties.getProperty(componentName + ".jettyConnectorClassName") != null) {
jettyConnectorClassName = properties.getProperty(componentName + ".jettyConnectorClassName");
@@ -799,6 +821,10 @@ public class HttpConfiguration implement
.valueOf(properties.getProperty(componentName + ".wantHeadersFromHttpIntoExchange"))
.booleanValue();
}
+ if (properties.getProperty(componentName + ".preemptiveAuthentication") != null) {
+ preemptiveAuthentication = Boolean.valueOf(properties.getProperty(componentName + ".preemptiveAuthentication")).booleanValue();
+ }
+
return true;
}