public PollingConsumer createPollingConsumer() throws Exception { HttpPollingConsumer answer = new HttpPollingConsumer(this); configurePollingConsumer(answer); return answer; }
public HttpProducer(HttpEndpoint endpoint) { super(endpoint); this.httpClient = endpoint.createHttpClient(); this.throwException = endpoint.isThrowExceptionOnFailure(); this.transferException = endpoint.isTransferException(); }
@Override public void configureHttpClient(HttpClient client) { for (HttpClientConfigurer configurer : configurers) { configurer.configureHttpClient(client); } }
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);
private HttpClient createHttpClient(ResultBuilder builder, Map<String, Object> parameters) throws Exception { HttpClientParams clientParams = setProperties(new HttpClientParams(), "httpClient.", parameters); HttpClient client = new HttpClient(clientParams); CompositeHttpConfigurer configurer = new CompositeHttpConfigurer(); configureProxy(builder, parameters).ifPresent(configurer::addConfigurer); configureAuthentication(builder, parameters).ifPresent(configurer::addConfigurer); configurer.configureHttpClient(client); return client; } }
import org.apache.camel.component.http4.HttpComponent; ... final HttpComponent myComponent = new HttpComponent(); myComponent.setClientConnectionManager(new PoolingClientConnectionManager()); myComponent.setHttpClientConfigurer(new myHttpClientConfigurer());
public static CompositeHttpConfigurer combineConfigurers(HttpClientConfigurer oldConfigurer, HttpClientConfigurer newConfigurer) { if (oldConfigurer instanceof CompositeHttpConfigurer) { ((CompositeHttpConfigurer)oldConfigurer).addConfigurer(newConfigurer); return (CompositeHttpConfigurer)oldConfigurer; } else { CompositeHttpConfigurer answer = new CompositeHttpConfigurer(); answer.addConfigurer(newConfigurer); answer.addConfigurer(oldConfigurer); return answer; } }
public Exchange receive(long timeout) { return doReceive((int) timeout); }
@Converter public static RequestEntity toRequestEntity(byte[] data, Exchange exchange) throws Exception { return asRequestEntity(data, exchange); }
public HttpComponent(Class<? extends HttpEndpoint> endpointClass) { super(endpointClass); registerExtension(HttpComponentVerifierExtension::new); }
protected HttpEndpoint createHttpEndpoint(String uri, HttpComponent component, HttpClientParams clientParams, HttpConnectionManager connectionManager, HttpClientConfigurer configurer) throws URISyntaxException { return new HttpEndpoint(uri, component, clientParams, connectionManager, configurer); }
public HttpPollingConsumer(HttpEndpoint endpoint) { super(endpoint); this.endpoint = endpoint; this.httpClient = endpoint.createHttpClient(); }
public Producer createProducer() throws Exception { return new HttpProducer(this); }
public static Optional<String> responseHeaderValue(HttpMethod method, String headerName) { return responseHeader(method, headerName) .map(m -> Optional.ofNullable(m.getValue())) .orElseGet(Optional::empty); } }
@Override public ComponentVerifier getVerifier() { return (scope, parameters) -> getExtension(ComponentVerifierExtension.class).orElseThrow(UnsupportedOperationException::new).verify(scope, parameters); } }
public <T> T evaluate(Exchange exchange, Class<T> type) { return ExpressionBuilder.constantExpression(name()).evaluate(exchange, type); }
HttpComponent httpComponent = new HttpComponent(); context.addComponent("http", httpComponent);
public Exchange receiveNoWait() { return doReceive(-1); }
@Converter public static RequestEntity toRequestEntity(InputStream inStream, Exchange exchange) throws Exception { return asRequestEntity(inStream, exchange); }
public Exchange receive() { return doReceive(-1); }