Author: ningjiang Date: Tue Dec 13 01:22:35 2011 New Revision: 1213534 URL: http://svn.apache.org/viewvc?rev=1213534&view=rev Log: Merged revisions 1213232 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
........ r1213232 | ningjiang | 2011-12-12 21:27:56 +0800 (Mon, 12 Dec 2011) | 1 line Clean up the http uri code of camel-http ........ Modified: camel/branches/camel-2.8.x/ (props changed) camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java Propchange: camel/branches/camel-2.8.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Dec 13 01:22:35 2011 @@ -1 +1 @@ -/camel/trunk:1202148,1202167,1202204-1202206,1202214-1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113,1210771,1210830,1211363,1211414,1211773,1211811,1212275-1212276,1212408,1213197,1213219,1213526 +/camel/trunk:1202148,1202167,1202204-1202206,1202214-1202215,1202223,1202659,1202685,1203879,1203978,1204338,1205124,1205372,1205412,1205429,1205431,1205713,1206116,1206414,1207743,1207784,1208301,1208930,1208964-1208965,1209006-1209007,1209382,1209401,1209477,1209845-1209846,1210113,1210771,1210830,1211363,1211414,1211773,1211811,1212275-1212276,1212408,1213197,1213219,1213232,1213526 Propchange: camel/branches/camel-2.8.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=1213534&r1=1213533&r2=1213534&view=diff ============================================================================== --- camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java (original) +++ camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Tue Dec 13 01:22:35 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/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=1213534&r1=1213533&r2=1213534&view=diff ============================================================================== --- camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java (original) +++ camel/branches/camel-2.8.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java Tue Dec 13 01:22:35 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 {