You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/12/12 14:27:57 UTC
svn commit: r1213232 - in
/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http:
HttpComponent.java HttpEndpoint.java
Author: ningjiang
Date: Mon Dec 12 13:27:56 2011
New Revision: 1213232
URL: http://svn.apache.org/viewvc?rev=1213232&view=rev
Log:
Clean up the http uri code of camel-http
Modified:
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=1213232&r1=1213231&r2=1213232&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Mon Dec 12 13:27:56 2011
@@ -207,11 +207,6 @@ public class HttpComponent extends Heade
// try without ref
binding = resolveAndRemoveReferenceParameter(parameters, "httpBinding", HttpBinding.class);
}
- Boolean throwExceptionOnFailure = getAndRemoveParameter(parameters, "throwExceptionOnFailure", Boolean.class);
- Boolean transferException = getAndRemoveParameter(parameters, "transferException", Boolean.class);
- Boolean bridgeEndpoint = getAndRemoveParameter(parameters, "bridgeEndpoint", Boolean.class);
- Boolean matchOnUriPrefix = getAndRemoveParameter(parameters, "matchOnUriPrefix", Boolean.class);
- Boolean disableStreamCache = getAndRemoveParameter(parameters, "disableStreamCache", Boolean.class);
String proxyHost = getAndRemoveParameter(parameters, "proxyHost", String.class);
Integer proxyPort = getAndRemoveParameter(parameters, "proxyPort", Integer.class);
String authMethodPriority = getAndRemoveParameter(parameters, "authMethodPriority", String.class);
@@ -225,22 +220,9 @@ public class HttpComponent extends Heade
final Set<AuthMethod> authMethods = new LinkedHashSet<AuthMethod>();
HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods);
URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(httpClientParameters));
- // restructure uri to be based on the parameters left as we dont want to include the Camel internal options
- URI httpUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(parameters));
-
- // validate http uri that end-user did not duplicate the http part that can be a common error
- String part = httpUri.getSchemeSpecificPart();
- if (part != null) {
- part = part.toLowerCase();
- if (part.startsWith("//http//") || part.startsWith("//https//") || part.startsWith("//http://") || part.startsWith("//https://")) {
- throw new ResolveEndpointFailedException(uri,
- "The uri part is not configured correctly. You have duplicated the http(s) protocol.");
- }
- }
- // need to keep the parameters of http client configure to avoid unwiser endpoint caching
-
+
// create the endpoint
- HttpEndpoint endpoint = new HttpEndpoint(endpointUri.toString(), this, httpUri, clientParams, httpConnectionManager, configurer);
+ HttpEndpoint endpoint = new HttpEndpoint(endpointUri.toString(), this, clientParams, httpConnectionManager, configurer);
setEndpointHeaderFilterStrategy(endpoint);
// prefer to use endpoint configured over component configured
@@ -251,23 +233,6 @@ public class HttpComponent extends Heade
if (binding != null) {
endpoint.setBinding(binding);
}
- // should we use an exception for failed error codes?
- if (throwExceptionOnFailure != null) {
- endpoint.setThrowExceptionOnFailure(throwExceptionOnFailure);
- }
- // should we transfer exception as serialized object
- if (transferException != null) {
- endpoint.setTransferException(transferException);
- }
- if (bridgeEndpoint != null) {
- endpoint.setBridgeEndpoint(bridgeEndpoint);
- }
- if (matchOnUriPrefix != null) {
- endpoint.setMatchOnUriPrefix(matchOnUriPrefix);
- }
- if (disableStreamCache != null) {
- endpoint.setDisableStreamCache(disableStreamCache);
- }
if (proxyHost != null) {
endpoint.setProxyHost(proxyHost);
endpoint.setProxyPort(proxyPort);
@@ -287,8 +252,20 @@ public class HttpComponent extends Heade
endpoint.setAuthMethodPriority(authMethodPriority);
}
}
-
setProperties(endpoint, parameters);
+ // restructure uri to be based on the parameters left as we dont want to include the Camel internal options
+ URI httpUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(parameters));
+
+ // validate http uri that end-user did not duplicate the http part that can be a common error
+ String part = httpUri.getSchemeSpecificPart();
+ if (part != null) {
+ part = part.toLowerCase();
+ if (part.startsWith("//http//") || part.startsWith("//https//") || part.startsWith("//http://") || part.startsWith("//https://")) {
+ throw new ResolveEndpointFailedException(uri,
+ "The uri part is not configured correctly. You have duplicated the http(s) protocol.");
+ }
+ }
+ endpoint.setHttpUri(httpUri);
return endpoint;
}
Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=1213232&r1=1213231&r2=1213232&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java Mon Dec 12 13:27:56 2011
@@ -70,6 +70,11 @@ public class HttpEndpoint extends Defaul
public HttpEndpoint(String endPointURI, HttpComponent component, URI httpURI, HttpConnectionManager httpConnectionManager) throws URISyntaxException {
this(endPointURI, component, httpURI, new HttpClientParams(), httpConnectionManager, null);
}
+
+ public HttpEndpoint(String endPointURI, HttpComponent component, HttpClientParams clientParams,
+ HttpConnectionManager httpConnectionManager, HttpClientConfigurer clientConfigurer) throws URISyntaxException {
+ this(endPointURI, component, null, clientParams, httpConnectionManager, clientConfigurer);
+ }
public HttpEndpoint(String endPointURI, HttpComponent component, URI httpURI, HttpClientParams clientParams,
HttpConnectionManager httpConnectionManager, HttpClientConfigurer clientConfigurer) throws URISyntaxException {