String authUsername = "MyUser"; String authPassword = "MyPass"; HttpComponent http = new HttpComponent(); HttpConfiguration config = http.getHttpConfiguration(); config.setAuthMethod(AuthMethod.Basic); config.setAuthUsername(authUsername); config.setAuthPassword(authPassword); http.setHttpConfiguration(config);
@Override public ComponentVerifier getVerifier() { return (scope, parameters) -> getExtension(ComponentVerifierExtension.class).orElseThrow(UnsupportedOperationException::new).verify(scope, parameters); } }
HttpBinding binding = resolveAndRemoveReferenceParameter(parameters, "httpBinding", HttpBinding.class); HeaderFilterStrategy headerFilterStrategy = resolveAndRemoveReferenceParameter(parameters, "headerFilterStrategy", HeaderFilterStrategy.class); UrlRewrite urlRewrite = resolveAndRemoveReferenceParameter(parameters, "urlRewrite", UrlRewrite.class); validateParameters(uri, httpClientOptions, null); validateParameters(uri, httpConnectionManagerOptions, null); HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods); addressUri = UnsafeUriCharactersEncoder.encodeHttpURI(addressUri); URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), httpClientParameters); HttpEndpoint endpoint = createHttpEndpoint(endpointUri.toString(), this, clientParams, thisHttpConnectionManager, configurer); if (getHttpConfiguration() != null) { Map<String, Object> properties = new HashMap<>(); IntrospectionSupport.getProperties(getHttpConfiguration(), properties, null); setProperties(endpoint, properties); endpoint.setHeaderFilterStrategy(headerFilterStrategy); } else { setEndpointHeaderFilterStrategy(endpoint); getCamelContext().addService(urlRewrite); endpoint.setUrlRewrite(urlRewrite); binding = getHttpBinding(); setProperties(endpoint, parameters);
HttpClientConfigurer configurer = resolveAndRemoveReferenceParameter(parameters, "httpClientConfigurer", HttpClientConfigurer.class); if (configurer == null) { configurer = getHttpClientConfigurer(); String authUsername = getParameter(parameters, "authUsername", String.class); String authMethod = getParameter(parameters, "authMethod", String.class); String authPassword = getParameter(parameters, "authPassword", String.class); String authDomain = getParameter(parameters, "authDomain", String.class); String authHost = getParameter(parameters, "authHost", String.class); configurer = configureAuth(configurer, authMethod, authUsername, authPassword, authDomain, authHost, authMethods); } else if (httpConfiguration != null) { configurer = configureAuth(configurer, httpConfiguration.getAuthMethod(), httpConfiguration.getAuthUsername(), httpConfiguration.getAuthPassword(), httpConfiguration.getAuthDomain(), httpConfiguration.getAuthHost(), authMethods); String proxyAuthUsername = getParameter(parameters, "proxyAuthUsername", String.class); String proxyAuthMethod = getParameter(parameters, "proxyAuthMethod", String.class); String proxyAuthPassword = getParameter(parameters, "proxyAuthPassword", String.class); String proxyAuthDomain = getParameter(parameters, "proxyAuthDomain", String.class); String proxyAuthHost = getParameter(parameters, "proxyAuthHost", String.class); configurer = configureProxyAuth(configurer, proxyAuthMethod, proxyAuthUsername, proxyAuthPassword, proxyAuthDomain, proxyAuthHost, authMethods); } else if (httpConfiguration != null) { configurer = configureProxyAuth(configurer, httpConfiguration.getProxyAuthMethod(), httpConfiguration.getProxyAuthUsername(), httpConfiguration.getProxyAuthPassword(), httpConfiguration.getProxyAuthDomain(), httpConfiguration.getProxyAuthHost(), authMethods);
@ConditionalOnMissingBean(HttpComponent.class) public HttpComponent configureHttpComponent() throws Exception { HttpComponent component = new HttpComponent(); component.setCamelContext(camelContext); Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null,
import org.apache.camel.component.http4.HttpComponent; ... final HttpComponent myComponent = new HttpComponent(); myComponent.setClientConnectionManager(new PoolingClientConnectionManager()); myComponent.setHttpClientConfigurer(new myHttpClientConfigurer());
ObjectHelper.notNull(password, "proxyAuthPassword"); AuthMethod auth = getCamelContext().getTypeConverter().convertTo(AuthMethod.class, authMethod);
HttpComponent httpComponent = new HttpComponent(); context.addComponent("http", httpComponent);
ObjectHelper.notNull(password, "authPassword"); AuthMethod auth = getCamelContext().getTypeConverter().convertTo(AuthMethod.class, authMethod);