io.undertow.client.UndertowClient Java Examples

The following examples show how to use io.undertow.client.UndertowClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public UndertowXnioBufferSupport() {
	this.xnioBufferPool = new org.xnio.ByteBufferSlicePool(1048, 1048);
	this.httpClientConnectCallbackMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
			ClientCallback.class, URI.class, XnioWorker.class, Pool.class, OptionMap.class);
	this.httpClientConnectMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
			URI.class, XnioWorker.class, Pool.class, OptionMap.class);
}
 
Example #2
Source File: LoadBalancingProxyClient.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public LoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker, HostSelector hostSelector) {
    this.client = client;
    this.exclusivityChecker = exclusivityChecker;
    sessionCookieNames.add("JSESSIONID");
    if(hostSelector == null) {
        this.hostSelector = new RoundRobinHostSelector();
    } else {
        this.hostSelector = hostSelector;
    }
}
 
Example #3
Source File: UndertowXhrTransport.java    From spring-analysis-note with MIT License 5 votes vote down vote up
public UndertowXhrTransport(OptionMap optionMap) throws IOException {
	Assert.notNull(optionMap, "OptionMap is required");
	this.optionMap = optionMap;
	this.httpClient = UndertowClient.getInstance();
	this.worker = Xnio.getInstance().createWorker(optionMap);
	this.bufferPool = new DefaultByteBufferPool(false, 1024, -1, 2);
}
 
Example #4
Source File: ProxyConnectionPool.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public ProxyConnectionPool(ConnectionPoolManager connectionPoolManager, InetSocketAddress bindAddress,URI uri, XnioSsl ssl, UndertowClient client, OptionMap options) {
    this.connectionPoolManager = connectionPoolManager;
    this.maxConnections = Math.max(connectionPoolManager.getMaxConnections(), 1);
    this.maxCachedConnections = Math.max(connectionPoolManager.getMaxCachedConnections(), 0);
    this.coreCachedConnections = Math.max(connectionPoolManager.getSMaxConnections(), 0);
    this.timeToLive = connectionPoolManager.getTtl();
    this.bindAddress = bindAddress;
    this.uri = uri;
    this.ssl = ssl;
    this.client = client;
    this.options = options;
}
 
Example #5
Source File: MultiAppProxyClient.java    From bouncr with Eclipse Public License 1.0 5 votes vote down vote up
public MultiAppProxyClient(BouncrConfiguration config, KeyValueStore store, RealmCache realmCache, JsonWebToken jwt) {
    client = UndertowClient.getInstance();
    this.config = config;
    this.store = store;
    this.realmCache = realmCache;
    this.jwt = jwt;
    this.jwtHeader = BeanBuilder.builder(new JwtHeader())
            .set(JwtHeader::setAlg, "none")
            .build();
}
 
Example #6
Source File: NodePingUtil.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
HttpClientPingTask(URI connection, RequestExchangeListener exchangeListener, XnioIoThread thread, UndertowClient client, XnioSsl xnioSsl, ByteBufferPool bufferPool, OptionMap options) {
    this.connection = connection;
    this.thread = thread;
    this.client = client;
    this.xnioSsl = xnioSsl;
    this.bufferPool = bufferPool;
    this.options = options;
    this.exchangeListener = exchangeListener;
}
 
Example #7
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public UndertowXhrTransport(OptionMap optionMap) throws IOException {
	Assert.notNull(optionMap, "OptionMap is required");
	this.optionMap = optionMap;
	this.httpClient = UndertowClient.getInstance();
	this.worker = Xnio.getInstance().createWorker(optionMap);
	this.undertowBufferSupport =
			(undertow13Present ? new Undertow13BufferSupport() : new UndertowXnioBufferSupport());
}
 
Example #8
Source File: ModClusterContainer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
ModClusterContainer(final ModCluster modCluster, final XnioSsl xnioSsl, final UndertowClient client, OptionMap clientOptions) {
    this.xnioSsl = xnioSsl;
    this.client = client;
    this.modCluster = modCluster;
    this.clientOptions = clientOptions;
    this.healthChecker = modCluster.getHealthChecker();
    this.proxyClient = new ModClusterProxyClient(null, this);
    this.removeBrokenNodesThreshold = removeThreshold(modCluster.getHealthCheckInterval(), modCluster.getRemoveBrokenNodes());
}
 
Example #9
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public IoFuture<ClientConnection> httpClientConnect(UndertowClient httpClient, URI uri,
		XnioWorker worker, OptionMap options) {
	return (IoFuture<ClientConnection>) ReflectionUtils.invokeMethod(httpClientConnectMethod, httpClient, uri,
			worker, this.xnioBufferPool, options);
}
 
Example #10
Source File: PoolHandler.java    From galeb with Apache License 2.0 5 votes vote down vote up
private ExtendedLoadBalancingProxyClient getProxyClient() {
    final HostSelector hostSelector = defineHostSelector();
    logger.info("[Pool " + pool.getName() + "] HostSelector: " + hostSelector.getClass().getSimpleName());

    final ExclusivityChecker exclusivityChecker = exclusivityCheckerExchange -> exclusivityCheckerExchange.getRequestHeaders().contains(Headers.UPGRADE);
    return new ExtendedLoadBalancingProxyClient(UndertowClient.getInstance(), exclusivityChecker, hostSelector)
                    .setTtl(Integer.parseInt(SystemEnv.POOL_CONN_TTL.getValue()))
                    .setConnectionsPerThread(getConnPerThread())
                    .setSoftMaxConnectionsPerThread(Integer.parseInt(SystemEnv.POOL_SOFTMAXCONN.getValue()));
}
 
Example #11
Source File: ExtendedLoadBalancingProxyClient.java    From galeb with Apache License 2.0 5 votes vote down vote up
public ExtendedLoadBalancingProxyClient(UndertowClient client, ExclusivityChecker exclusivityChecker, HostSelector hostSelector) {
    this.client = client;
    this.exclusivityChecker = exclusivityChecker;
    sessionCookieNames.add("JSESSIONID");
    if(hostSelector == null) {
        this.hostSelector = new RoundRobinHostSelector();
    } else {
        this.hostSelector = hostSelector;
    }
}
 
Example #12
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public Undertow13BufferSupport() {
	this.undertowBufferPool = new DefaultByteBufferPool(false, 1024, -1, 2);
	this.httpClientConnectCallbackMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
			ClientCallback.class, URI.class, XnioWorker.class, ByteBufferPool.class, OptionMap.class);
	this.httpClientConnectMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
			URI.class, XnioWorker.class, ByteBufferPool.class, OptionMap.class);
}
 
Example #13
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public IoFuture<ClientConnection> httpClientConnect(UndertowClient httpClient, URI uri,
		XnioWorker worker, OptionMap options) {
	return (IoFuture<ClientConnection>) ReflectionUtils.invokeMethod(httpClientConnectMethod, httpClient, uri,
			worker, this.undertowBufferPool, options);
}
 
Example #14
Source File: TokenAuthenticator.java    From hawkular-metrics with Apache License 2.0 5 votes vote down vote up
private ConnectionFactory(URI kubernetesMasterUri) {
    this.kubernetesMasterUri = kubernetesMasterUri;
    undertowClient = UndertowClient.getInstance();
    Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
    try {
        ssl = new UndertowXnioSsl(xnio, OptionMap.EMPTY);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    byteBufferPool = createByteBufferPool();
}
 
Example #15
Source File: SNICombinedWithALPNTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSimpleViaHostname() throws Exception {
    Assume.assumeFalse("There is no ALPN implementation in IBM JDK 8 and less; also ALPN-hack that serves" +
                    " as a workaround for other JDKs does not work with IBM JDK.", isIbmJdk() && jdkLessThan9());

    XnioSsl ssl = createClientSSL(hostNameKeystore);
    UndertowClient client = UndertowClient.getInstance();
    DefaultByteBufferPool pool = new DefaultByteBufferPool(false, 1024);
    ClientConnection connection = client.connect(new URI("https", null, "localhost", TestSuiteEnvironment.getHttpPort(), "", null, null), XnioWorker.getContextManager().get(), ssl, pool, OptionMap.create(UndertowOptions.ENABLE_HTTP2, true)).get();
    performSimpleTest(pool, connection);
}
 
Example #16
Source File: UndertowXhrTransport.java    From java-technology-stack with MIT License 5 votes vote down vote up
public UndertowXhrTransport(OptionMap optionMap) throws IOException {
	Assert.notNull(optionMap, "OptionMap is required");
	this.optionMap = optionMap;
	this.httpClient = UndertowClient.getInstance();
	this.worker = Xnio.getInstance().createWorker(optionMap);
	this.bufferPool = new DefaultByteBufferPool(false, 1024, -1, 2);
}
 
Example #17
Source File: SNICombinedWithALPNTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testHttpsViaIp() throws Exception {
    Assume.assumeFalse("There is no ALPN implementation in IBM JDK 8 and less; also ALPN-hack that serves" +
            " as a workaround for other JDKs does not work with IBM JDK.", isIbmJdk() && jdkLessThan9());

    XnioSsl ssl = createClientSSL(ipKeystore);
    UndertowClient client = UndertowClient.getInstance();
    DefaultByteBufferPool pool = new DefaultByteBufferPool(false, 1024);
    ClientConnection connection = client.connect(new URI("https", null, "127.0.0.1", TestSuiteEnvironment.getHttpPort(), "", null, null), XnioWorker.getContextManager().get(), ssl, pool, OptionMap.create(UndertowOptions.ENABLE_HTTP2, true)).get();
    performSimpleTest(pool, connection);
}
 
Example #18
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void httpClientConnect(UndertowClient httpClient, ClientCallback<ClientConnection> listener, URI uri,
		XnioWorker worker, OptionMap options) {
	ReflectionUtils.invokeMethod(httpClientConnectCallbackMethod, httpClient, listener, uri, worker,
			this.xnioBufferPool, options);
}
 
Example #19
Source File: LoadBalancingProxyClient.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public LoadBalancingProxyClient(UndertowClient client) {
    this(client, null, null);
}
 
Example #20
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
IoFuture<ClientConnection> httpClientConnect(UndertowClient httpClient, final URI uri,
final XnioWorker worker, OptionMap options);
 
Example #21
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
void httpClientConnect(UndertowClient httpClient, final ClientCallback<ClientConnection> listener,
final URI uri, final XnioWorker worker, OptionMap options);
 
Example #22
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Return Undertow's native HTTP client
 */
public UndertowClient getHttpClient() {
	return this.httpClient;
}
 
Example #23
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void httpClientConnect(UndertowClient httpClient, ClientCallback<ClientConnection> listener, URI uri,
		XnioWorker worker, OptionMap options) {
	ReflectionUtils.invokeMethod(httpClientConnectCallbackMethod, httpClient, listener, uri,
			worker, this.undertowBufferPool, options);
}
 
Example #24
Source File: ProxyConnectionPool.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public ProxyConnectionPool(ConnectionPoolManager connectionPoolManager, URI uri, XnioSsl ssl, UndertowClient client, OptionMap options) {
    this(connectionPoolManager, null, uri, ssl, client, options);
}
 
Example #25
Source File: ProxyConnectionPool.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public ProxyConnectionPool(ConnectionPoolManager connectionPoolManager,InetSocketAddress bindAddress, URI uri, UndertowClient client, OptionMap options) {
    this(connectionPoolManager, bindAddress, uri, null, client, options);
}
 
Example #26
Source File: ModCluster.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public static Builder builder(final XnioWorker worker, final UndertowClient client, final XnioSsl xnioSsl) {
    return new Builder(worker, client, xnioSsl);
}
 
Example #27
Source File: UndertowXhrTransport.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Return Undertow's native HTTP client.
 */
public UndertowClient getHttpClient() {
	return this.httpClient;
}
 
Example #28
Source File: UndertowXhrTransport.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Return Undertow's native HTTP client.
 */
public UndertowClient getHttpClient() {
	return this.httpClient;
}
 
Example #29
Source File: ExtendedLoadBalancingProxyClient.java    From galeb with Apache License 2.0 4 votes vote down vote up
public ExtendedLoadBalancingProxyClient() {
    this(UndertowClient.getInstance());
}
 
Example #30
Source File: ExtendedLoadBalancingProxyClient.java    From galeb with Apache License 2.0 4 votes vote down vote up
public ExtendedLoadBalancingProxyClient(UndertowClient client) {
    this(client, null, null);
}