WIP removed unused features
Change-Id: Ibe4a042c406509800fc542b4e191e72b93345f14
diff --git a/org.eclipse.scout.rt.rest.jersey.client/pom.xml b/org.eclipse.scout.rt.rest.jersey.client/pom.xml
index d96aea7..372410d 100644
--- a/org.eclipse.scout.rt.rest.jersey.client/pom.xml
+++ b/org.eclipse.scout.rt.rest.jersey.client/pom.xml
@@ -31,6 +31,11 @@
<artifactId>org.eclipse.scout.rt.rest</artifactId>
</dependency>
+ <dependency> <!-- FIXME PBZ remove -->
+ <groupId>org.eclipse.scout.rt</groupId>
+ <artifactId>org.eclipse.scout.rt.shared</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/JerseyClientConfigFactory.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/JerseyClientConfigFactory.java
index 742b2ef..08c333c 100644
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/JerseyClientConfigFactory.java
+++ b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/JerseyClientConfigFactory.java
@@ -10,22 +10,9 @@
******************************************************************************/
package org.eclipse.scout.rt.rest.jersey.client;
-import java.util.concurrent.TimeUnit;
-
-import javax.net.ssl.SSLSocketFactory;
import javax.ws.rs.core.Configuration;
-import org.apache.http.config.RegistryBuilder;
-import org.apache.http.conn.HttpClientConnectionManager;
-import org.apache.http.conn.socket.ConnectionSocketFactory;
-import org.apache.http.conn.socket.PlainConnectionSocketFactory;
-import org.apache.http.conn.ssl.DefaultHostnameVerifier;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.util.PublicSuffixMatcherLoader;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.eclipse.scout.rt.platform.util.StringUtility;
import org.eclipse.scout.rt.rest.client.IRestClientConfigFactory;
-import org.eclipse.scout.rt.rest.jersey.client.connector.ApacheClientProperties;
import org.eclipse.scout.rt.rest.jersey.client.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
@@ -41,69 +28,7 @@
return clientConfig;
}
- /**
- * This default implementation delegates to {@link IJerseyConnectorProviderFactory#createConnectorProvider()}
- */
protected void initConnectionProvider(ClientConfig clientConfig) {
clientConfig.connectorProvider(new ApacheConnectorProvider());
- clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, createConnectionManager());
- }
-
- /**
- * Creates a preconfigured Apache HTTP {@link HttpClientConnectionManager}. This default implementation supports up to
- * 32 concurrent connections to one particular route and 128 in total.
- */
- protected HttpClientConnectionManager createConnectionManager() {
- String[] sslProtocols = StringUtility.split(System.getProperty("https.protocols"), "\\s*,\\s*");
- String[] sslCipherSuites = StringUtility.split(System.getProperty("https.cipherSuites"), "\\s*,\\s*");
-
- SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
- (SSLSocketFactory) SSLSocketFactory.getDefault(),
- sslProtocols != null && sslProtocols.length > 0 ? sslProtocols : null,
- sslCipherSuites != null && sslCipherSuites.length > 0 ? sslCipherSuites : null,
- new DefaultHostnameVerifier(PublicSuffixMatcherLoader.getDefault()));
-
- final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(
- RegistryBuilder.<ConnectionSocketFactory> create()
- .register("http", PlainConnectionSocketFactory.getSocketFactory())
- .register("https", sslConnectionSocketFactory)
- .build(),
- null, null, null, getKeepAliveTimeoutMillis(), TimeUnit.MILLISECONDS);
- connectionManager.setValidateAfterInactivity(1);
-
- final int maxTotal = getMaxConnectionsTotal();
- if (maxTotal > 0) {
- connectionManager.setMaxTotal(maxTotal);
- }
-
- final int defaultMaxPerRoute = getMaxConnectionsPerRoute();
- if (defaultMaxPerRoute > 0) {
- connectionManager.setDefaultMaxPerRoute(defaultMaxPerRoute);
- }
-
- return connectionManager;
- }
-
- /**
- * Max timeout in ms connections are kept open when idle (requires keep-alive support). Default is 30 minutes.
- */
- protected long getKeepAliveTimeoutMillis() {
- return TimeUnit.MINUTES.toMillis(30);
- }
-
- /**
- * Max number of total concurrent connections managed by the {@link HttpClientConnectionManager} returned by
- * {@link #createConnectionManager()}. Default is 128.
- */
- protected int getMaxConnectionsTotal() {
- return 128;
- }
-
- /**
- * Max number of concurrent connections per route managed by the {@link HttpClientConnectionManager} returned by
- * {@link #createConnectionManager()}. Default is 32.
- */
- protected int getMaxConnectionsPerRoute() {
- return 32;
}
}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheClientProperties.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheClientProperties.java
deleted file mode 100644
index 6276e23..0000000
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheClientProperties.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.eclipse.scout.rt.rest.jersey.client.connector;
-
-import java.util.Map;
-
-import org.glassfish.jersey.internal.util.PropertiesClass;
-import org.glassfish.jersey.internal.util.PropertiesHelper;
-
-/**
- * Configuration options specific to the Client API that utilizes {@link ApacheConnectorProvider}.
- *
- * @author jorgeluisw@mac.com
- * @author Paul Sandoz
- * @author Pavel Bucek (pavel.bucek at oracle.com)
- * @author Arul Dhesiaseelan (aruld at acm.org)
- */
-@PropertiesClass
-public final class ApacheClientProperties {
-
- /**
- * The credential provider that should be used to retrieve
- * credentials from a user. Credentials needed for proxy authentication
- * are stored here as well.
- * <p/>
- * The value MUST be an instance of {@link org.apache.http.client.CredentialsProvider}.
- * <p/>
- * If the property is absent a default provider will be used.
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- */
- public static final String CREDENTIALS_PROVIDER = "jersey.config.apache.client.credentialsProvider";
-
- /**
- * A value of {@code false} indicates the client should handle cookies
- * automatically using HttpClient's default cookie policy. A value
- * of {@code true} will cause the client to ignore all cookies.
- * <p/>
- * The value MUST be an instance of {@link java.lang.Boolean}.
- * <p/>
- * The default value is {@code false}.
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- */
- public static final String DISABLE_COOKIES = "jersey.config.apache.client.handleCookies";
-
- /**
- * A value of {@code true} indicates that a client should send an
- * authentication request even before the server gives a 401
- * response.
- * <p>
- * This property may only be set prior to constructing Apache connector using {@link ApacheConnectorProvider}.
- * <p/>
- * The value MUST be an instance of {@link java.lang.Boolean}.
- * <p/>
- * The default value is {@code false}.
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- */
- public static final String PREEMPTIVE_BASIC_AUTHENTICATION = "jersey.config.apache.client.preemptiveBasicAuthentication";
-
- /**
- * Connection Manager which will be used to create {@link org.apache.http.client.HttpClient}.
- * <p/>
- * The value MUST be an instance of {@link org.apache.http.conn.HttpClientConnectionManager}.
- * <p/>
- * If the property is absent a default Connection Manager will be used
- * ({@link org.apache.http.impl.conn.BasicHttpClientConnectionManager}).
- * If you want to use this client in multi-threaded environment, be sure you override default value with
- * {@link org.apache.http.impl.conn.PoolingHttpClientConnectionManager} instance.
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- */
- public static final String CONNECTION_MANAGER = "jersey.config.apache.client.connectionManager";
-
- /**
- * A value of {@code true} indicates that configured connection manager should be shared
- * among multiple Jersey {@link org.glassfish.jersey.client.ClientRuntime} instances. It means that closing
- * a particular {@link org.glassfish.jersey.client.ClientRuntime} instance does not shut down the underlying
- * connection manager automatically. In such case, the connection manager life-cycle
- * should be fully managed by the application code. To release all allocated resources,
- * caller code should especially ensure {@link org.apache.http.conn.HttpClientConnectionManager#shutdown()} gets
- * invoked eventually.
- * <p>
- * This property may only be set prior to constructing Apache connector using {@link ApacheConnectorProvider}.
- * <p/>
- * The value MUST be an instance of {@link java.lang.Boolean}.
- * <p/>
- * The default value is {@code false}.
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- *
- * @since 2.18
- */
- public static final String CONNECTION_MANAGER_SHARED = "jersey.config.apache.client.connectionManagerShared";
-
- /**
- * Request configuration for the {@link org.apache.http.client.HttpClient}.
- * Http parameters which will be used to create {@link org.apache.http.client.HttpClient}.
- * <p/>
- * The value MUST be an instance of {@link org.apache.http.client.config.RequestConfig}.
- * <p/>
- * If the property is absent default request configuration will be used.
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- *
- * @since 2.5
- */
- public static final String REQUEST_CONFIG = "jersey.config.apache.client.requestConfig";
-
- /**
- * HttpRequestRetryHandler which will be used to create {@link org.apache.http.client.HttpClient}.
- * <p/>
- * The value MUST be an instance of {@link org.apache.http.client.HttpRequestRetryHandler}.
- * <p/>
- * If the property is absent a default retry handler will be used
- * ({@link org.apache.http.impl.client.DefaultHttpRequestRetryHandler}).
- * <p/>
- * The name of the configuration property is <tt>{@value}</tt>.
- */
- public static final String RETRY_HANDLER = "jersey.config.apache.client.retryHandler";
-
- /**
- * Get the value of the specified property.
- *
- * If the property is not set or the actual property value type is not compatible with the specified type, the method will
- * return {@code null}.
- *
- * @param properties Map of properties to get the property value from.
- * @param key Name of the property.
- * @param type Type to retrieve the value as.
- * @param <T> Type of the property value.
- * @return Value of the property or {@code null}.
- *
- * @since 2.8
- */
- public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) {
- return PropertiesHelper.getValue(properties, key, type, null);
- }
-
- /**
- * Prevents instantiation.
- */
- private ApacheClientProperties() {
- throw new AssertionError("No instances allowed.");
- }
-}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnector.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnector.java
index a205c0c..5dc08c6 100644
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnector.java
+++ b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnector.java
@@ -43,7 +43,6 @@
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.Closeable;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -54,13 +53,7 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
import javax.ws.rs.core.Configuration;
@@ -71,122 +64,39 @@
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.AuthCache;
-import org.apache.http.client.CookieStore;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.HttpRequestRetryHandler;
-import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.config.ConnectionConfig;
-import org.apache.http.config.Registry;
-import org.apache.http.config.RegistryBuilder;
-import org.apache.http.conn.HttpClientConnectionManager;
-import org.apache.http.conn.ManagedHttpClientConnection;
-import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.conn.socket.ConnectionSocketFactory;
-import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
-import org.apache.http.conn.socket.PlainConnectionSocketFactory;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.SSLContexts;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.entity.BufferedHttpEntity;
-import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.impl.auth.BasicScheme;
-import org.apache.http.impl.client.BasicAuthCache;
-import org.apache.http.impl.client.BasicCookieStore;
-import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.impl.conn.DefaultManagedHttpClientConnection;
-import org.apache.http.impl.conn.ManagedHttpClientConnectionFactory;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.impl.io.ChunkedOutputStream;
-import org.apache.http.io.SessionOutputBuffer;
-import org.apache.http.util.TextUtils;
+import org.eclipse.scout.rt.platform.BEANS;
import org.eclipse.scout.rt.platform.context.RunMonitor;
import org.eclipse.scout.rt.platform.util.concurrent.ICancellable;
+import org.eclipse.scout.rt.shared.http.transport.ApacheHttpTransport;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.ClientRequest;
import org.glassfish.jersey.client.ClientResponse;
import org.glassfish.jersey.client.RequestEntityProcessing;
import org.glassfish.jersey.client.spi.AsyncConnectorCallback;
import org.glassfish.jersey.client.spi.Connector;
-import org.glassfish.jersey.internal.util.PropertiesHelper;
import org.glassfish.jersey.message.internal.HeaderUtils;
import org.glassfish.jersey.message.internal.OutboundMessageContext;
import org.glassfish.jersey.message.internal.ReaderWriter;
import org.glassfish.jersey.message.internal.Statuses;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A {@link Connector} that utilizes the Apache HTTP Client to send and receive HTTP request and responses.
- * <p/>
- * The following properties are only supported at construction of this class:
- * <ul>
- * <li>{@link ApacheClientProperties#CONNECTION_MANAGER}</li>
- * <li>{@link ApacheClientProperties#REQUEST_CONFIG}</li>
- * <li>{@link ApacheClientProperties#CREDENTIALS_PROVIDER}</li>
- * <li>{@link ApacheClientProperties#DISABLE_COOKIES}</li>
- * <li>{@link ClientProperties#PROXY_URI}</li>
- * <li>{@link ClientProperties#PROXY_USERNAME}</li>
- * <li>{@link ClientProperties#PROXY_PASSWORD}</li>
- * <li>{@link ClientProperties#REQUEST_ENTITY_PROCESSING} - default value is
- * {@link RequestEntityProcessing#CHUNKED}</li>
- * <li>{@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}</li>
- * <li>{@link ApacheClientProperties#RETRY_HANDLER}</li>
- * </ul>
- * <p>
- * This connector uses {@link RequestEntityProcessing#CHUNKED chunked encoding} as a default setting. This can be
- * overridden by the {@link ClientProperties#REQUEST_ENTITY_PROCESSING}. By default the
- * {@link ClientProperties#CHUNKED_ENCODING_SIZE} property is only supported by using default connection manager. If
- * custom connection manager needs to be used then chunked encoding size can be set by providing a custom
- * {@link org.apache.http.HttpClientConnection} (via custom
- * {@link org.apache.http.impl.conn.ManagedHttpClientConnectionFactory}) and overriding {@code createOutputStream}
- * method.
- * </p>
- * <p>
- * Using of authorization is dependent on the chunk encoding setting. If the entity buffering is enabled, the entity is
- * buffered and authorization can be performed automatically in response to a 401 by sending the request again. When
- * entity buffering is disabled (chunked encoding is used) then the property
- * {@link org.glassfish.jersey.apache.connector.ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION} must be set to
- * {@code true}.
- * </p>
- * <p>
- * If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and an entity is not read from the response then
- * {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be called after processing the response to release
- * connection-based resources.
- * </p>
- * <p>
- * Client operations are thread safe, the HTTP connection may be shared between different threads.
- * </p>
- * <p>
- * If a response entity is obtained that is an instance of {@link Closeable} then the instance MUST be closed after
- * processing the entity to release connection-based resources.
- * </p>
- * <p>
- * The following methods are currently supported: HEAD, GET, POST, PUT, DELETE, OPTIONS, PATCH and TRACE.
- * </p>
- *
- * @author jorgeluisw@mac.com
- * @author Paul Sandoz
- * @author Pavel Bucek (pavel.bucek at oracle.com)
- * @author Arul Dhesiaseelan (aruld at acm.org)
- * @see ApacheClientProperties#CONNECTION_MANAGER
*/
-@SuppressWarnings("deprecation")
-class ApacheConnector implements Connector {
+public class ApacheConnector implements Connector {
- private static final Logger LOGGER = Logger.getLogger(ApacheConnector.class.getName());
+ private static final Logger LOG = LoggerFactory.getLogger(ApacheConnector.class);
private final CloseableHttpClient m_client;
- private final CookieStore m_cookieStore;
- private final boolean m_preemptiveBasicAuth;
private final RequestConfig m_requestConfig;
/**
@@ -198,214 +108,12 @@
* client configuration.
*/
ApacheConnector(final Client client, final Configuration config) {
- final Object connectionManager = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER);
- if (connectionManager != null) {
- if (!(connectionManager instanceof HttpClientConnectionManager)) {
- LOGGER.log(Level.WARNING, "IGNORING_VALUE_OF_PROPERTY");
- }
- }
-
- Object reqConfig = config.getProperties().get(ApacheClientProperties.REQUEST_CONFIG);
- if (reqConfig != null) {
- if (!(reqConfig instanceof RequestConfig)) {
- LOGGER.log(Level.WARNING, "IGNORING_VALUE_OF_PROPERTY");
- reqConfig = null;
- }
- }
-
- final SSLContext sslContext = client.getSslContext();
- final HttpClientBuilder clientBuilder = HttpClientBuilder.create();
-
- clientBuilder.setConnectionManager(getConnectionManager(client, config, sslContext));
- clientBuilder.setConnectionManagerShared(
- PropertiesHelper.getValue(config.getProperties(), ApacheClientProperties.CONNECTION_MANAGER_SHARED, false, null));
- clientBuilder.setSslcontext(sslContext);
-
- final RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
-
- final Object credentialsProvider = config.getProperty(ApacheClientProperties.CREDENTIALS_PROVIDER);
- if (credentialsProvider != null && (credentialsProvider instanceof CredentialsProvider)) {
- clientBuilder.setDefaultCredentialsProvider((CredentialsProvider) credentialsProvider);
- }
-
- final Object retryHandler = config.getProperties().get(ApacheClientProperties.RETRY_HANDLER);
- if (retryHandler != null && (retryHandler instanceof HttpRequestRetryHandler)) {
- clientBuilder.setRetryHandler((HttpRequestRetryHandler) retryHandler);
- }
-
- final Object proxyUri;
- proxyUri = config.getProperty(ClientProperties.PROXY_URI);
- if (proxyUri != null) {
- final URI u = getProxyUri(proxyUri);
- final HttpHost proxy = new HttpHost(u.getHost(), u.getPort(), u.getScheme());
- final String userName;
- userName = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_USERNAME, String.class);
- if (userName != null) {
- final String password;
- password = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_PASSWORD, String.class);
-
- if (password != null) {
- final CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(
- new AuthScope(u.getHost(), u.getPort()),
- new UsernamePasswordCredentials(userName, password));
- clientBuilder.setDefaultCredentialsProvider(credsProvider);
- }
- }
- clientBuilder.setProxy(proxy);
- }
-
- final Boolean preemptiveBasicAuthProperty = (Boolean) config.getProperties()
- .get(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION);
- this.m_preemptiveBasicAuth = (preemptiveBasicAuthProperty != null) ? preemptiveBasicAuthProperty : false;
-
- final boolean ignoreCookies = PropertiesHelper.isProperty(config.getProperties(), ApacheClientProperties.DISABLE_COOKIES);
-
- if (reqConfig != null) {
- final RequestConfig.Builder reqConfigBuilder = RequestConfig.copy((RequestConfig) reqConfig);
- if (ignoreCookies) {
- reqConfigBuilder.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
- }
- m_requestConfig = reqConfigBuilder.build();
- }
- else {
- if (ignoreCookies) {
- requestConfigBuilder.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
- }
- m_requestConfig = requestConfigBuilder.build();
- }
-
- if (m_requestConfig.getCookieSpec() == null || !m_requestConfig.getCookieSpec().equals(CookieSpecs.IGNORE_COOKIES)) {
- this.m_cookieStore = new BasicCookieStore();
- clientBuilder.setDefaultCookieStore(m_cookieStore);
- }
- else {
- this.m_cookieStore = null;
- }
- clientBuilder.setDefaultRequestConfig(m_requestConfig);
- this.m_client = clientBuilder.build();
- }
-
- private HttpClientConnectionManager getConnectionManager(final Client client,
- final Configuration config,
- final SSLContext sslContext) {
- final Object cmObject = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER);
-
- // Connection manager from configuration.
- if (cmObject != null) {
- if (cmObject instanceof HttpClientConnectionManager) {
- return (HttpClientConnectionManager) cmObject;
- }
- else {
- LOGGER.log(
- Level.WARNING, "IGNORING_VALUE_OF_PROPERTY");
- }
- }
-
- // Create custom connection manager.
- return createConnectionManager(
- client,
- config,
- sslContext,
- false);
- }
-
- private HttpClientConnectionManager createConnectionManager(
- final Client client,
- final Configuration config,
- final SSLContext sslContext,
- final boolean useSystemProperties) {
-
- final String[] supportedProtocols = useSystemProperties ? split(
- System.getProperty("https.protocols")) : null;
- final String[] supportedCipherSuites = useSystemProperties ? split(
- System.getProperty("https.cipherSuites")) : null;
-
- HostnameVerifier hostnameVerifier = client.getHostnameVerifier();
-
- final LayeredConnectionSocketFactory sslSocketFactory;
- if (sslContext != null) {
- sslSocketFactory = new SSLConnectionSocketFactory(
- sslContext, supportedProtocols, supportedCipherSuites, hostnameVerifier);
- }
- else {
- if (useSystemProperties) {
- sslSocketFactory = new SSLConnectionSocketFactory(
- (SSLSocketFactory) SSLSocketFactory.getDefault(),
- supportedProtocols, supportedCipherSuites, hostnameVerifier);
- }
- else {
- sslSocketFactory = new SSLConnectionSocketFactory(
- SSLContexts.createDefault(),
- hostnameVerifier);
- }
- }
-
- final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory> create()
- .register("http", PlainConnectionSocketFactory.getSocketFactory())
- .register("https", sslSocketFactory)
- .build();
-
- final Integer chunkSize = ClientProperties.getValue(config.getProperties(),
- ClientProperties.CHUNKED_ENCODING_SIZE, ClientProperties.DEFAULT_CHUNK_SIZE, Integer.class);
-
- final PoolingHttpClientConnectionManager connectionManager =
- new PoolingHttpClientConnectionManager(registry, new ConnectionFactory(chunkSize));
-
- if (useSystemProperties) {
- String s = System.getProperty("http.keepAlive", "true");
- if ("true".equalsIgnoreCase(s)) {
- s = System.getProperty("http.maxConnections", "5");
- final int max = Integer.parseInt(s);
- connectionManager.setDefaultMaxPerRoute(max);
- connectionManager.setMaxTotal(2 * max);
- }
- }
-
- return connectionManager;
- }
-
- private static String[] split(final String s) {
- if (TextUtils.isBlank(s)) {
- return null;
- }
- return s.split(" *, *");
- }
-
- /**
- * Get the {@link HttpClient}.
- *
- * @return the {@link HttpClient}.
- */
- @SuppressWarnings("UnusedDeclaration")
- public HttpClient getHttpClient() {
- return m_client;
- }
-
- /**
- * Get the {@link CookieStore}.
- *
- * @return the {@link CookieStore} instance or {@code null} when {@value ApacheClientProperties#DISABLE_COOKIES} set
- * to {@code true}.
- */
- public CookieStore getCookieStore() {
- return m_cookieStore;
- }
-
- private static URI getProxyUri(final Object proxy) {
- if (proxy instanceof URI) {
- return (URI) proxy;
- }
- else if (proxy instanceof String) {
- return URI.create((String) proxy);
- }
- else {
- throw new ProcessingException("WRONG_PROXY_URI_TYPE");
- }
+ m_client = (CloseableHttpClient) ((ApacheHttpTransport) BEANS.get(RestClientHttpTransportManager.class).getHttpTransport()).getHttpClient();
+ m_requestConfig = RequestConfig.custom().build();
}
@Override
- public ClientResponse apply(final ClientRequest clientRequest) throws ProcessingException {
+ public ClientResponse apply(final ClientRequest clientRequest) {
final HttpUriRequest request = getUriHttpRequest(clientRequest);
final Map<String, String> clientHeadersSnapshot = writeOutBoundHeaders(clientRequest.getHeaders(), request);
@@ -414,19 +122,19 @@
try {
final CloseableHttpResponse response;
final HttpClientContext context = HttpClientContext.create();
- if (m_preemptiveBasicAuth) {
- final AuthCache authCache = new BasicAuthCache();
- final BasicScheme basicScheme = new BasicScheme();
- authCache.put(getHost(request), basicScheme);
- context.setAuthCache(authCache);
- }
+// if (m_preemptiveBasicAuth) {
+// final AuthCache authCache = new BasicAuthCache();
+// final BasicScheme basicScheme = new BasicScheme();
+// authCache.put(getHost(request), basicScheme);
+// context.setAuthCache(authCache);
+// }
// If a request-specific CredentialsProvider exists, use it instead of the default one
- CredentialsProvider credentialsProvider =
- clientRequest.resolveProperty(ApacheClientProperties.CREDENTIALS_PROVIDER, CredentialsProvider.class);
- if (credentialsProvider != null) {
- context.setCredentialsProvider(credentialsProvider);
- }
+// CredentialsProvider credentialsProvider =
+// clientRequest.resolveProperty(ApacheClientProperties.CREDENTIALS_PROVIDER, CredentialsProvider.class);
+// if (credentialsProvider != null) {
+// context.setCredentialsProvider(credentialsProvider);
+// }
response = m_client.execute(getHost(request), request, context);
HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, clientRequest.getHeaders(), this.getClass().getName());
@@ -470,7 +178,7 @@
responseContext.setEntityStream(new HttpClientResponseInputStream(getInputStream(response)));
}
catch (final IOException e) {
- LOGGER.log(Level.SEVERE, null, e);
+ LOG.warn("Failed to set response entity stream", e);
}
return responseContext;
@@ -496,7 +204,7 @@
@Override
public boolean cancel(boolean interruptIfRunning) {
- LOGGER.fine("Aborting HTTP REST request");
+ LOG.info("Aborting HTTP REST request");
request.abort();
return true;
}
@@ -527,18 +235,18 @@
@Override
public void close() {
try {
- m_client.close();
+ m_client.close(); // FIXME pbz need to close here or rely on httptransportmanager
}
catch (final IOException e) {
throw new ProcessingException("FAILED_TO_STOP_CLIENT", e);
}
}
- private HttpHost getHost(final HttpUriRequest request) {
+ protected HttpHost getHost(final HttpUriRequest request) {
return new HttpHost(request.getURI().getHost(), request.getURI().getPort(), request.getURI().getScheme());
}
- private HttpUriRequest getUriHttpRequest(final ClientRequest clientRequest) {
+ protected HttpUriRequest getUriHttpRequest(final ClientRequest clientRequest) {
final RequestConfig.Builder requestConfigBuilder = RequestConfig.copy(m_requestConfig);
final int connectTimeout = clientRequest.resolveProperty(ClientProperties.CONNECT_TIMEOUT, -1);
@@ -567,7 +275,7 @@
.build();
}
- private HttpEntity getHttpEntity(final ClientRequest clientRequest, final boolean bufferingEnabled) {
+ protected HttpEntity getHttpEntity(final ClientRequest clientRequest, final boolean bufferingEnabled) {
final Object entity = clientRequest.getEntity();
if (entity == null) {
@@ -586,7 +294,7 @@
}
@Override
- public InputStream getContent() throws IOException, IllegalStateException {
+ public InputStream getContent() throws IOException {
if (bufferingEnabled) {
final ByteArrayOutputStream buffer = new ByteArrayOutputStream(512);
writeTo(buffer);
@@ -627,7 +335,7 @@
}
}
- private static Map<String, String> writeOutBoundHeaders(final MultivaluedMap<String, Object> headers,
+ protected Map<String, String> writeOutBoundHeaders(final MultivaluedMap<String, Object> headers,
final HttpUriRequest request) {
final Map<String, String> stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers);
@@ -637,19 +345,15 @@
return stringHeaders;
}
+ // FIXME pbz unnötiger stream
private static final class HttpClientResponseInputStream extends FilterInputStream {
HttpClientResponseInputStream(final InputStream inputStream) throws IOException {
super(inputStream);
}
-
- @Override
- public void close() throws IOException {
- super.close();
- }
}
- private static InputStream getInputStream(final CloseableHttpResponse response) throws IOException {
+ protected InputStream getInputStream(final CloseableHttpResponse response) throws IOException {
final InputStream inputStream;
@@ -682,41 +386,4 @@
}
};
}
-
- private static class ConnectionFactory extends ManagedHttpClientConnectionFactory {
-
- private static final AtomicLong COUNTER = new AtomicLong();
-
- private final int chunkSize;
-
- private ConnectionFactory(final int chunkSize) {
- this.chunkSize = chunkSize;
- }
-
- @Override
- public ManagedHttpClientConnection create(final HttpRoute route, final ConnectionConfig config) {
- final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement());
-
- return new HttpClientConnection(id, config.getBufferSize(), chunkSize);
- }
- }
-
- private static class HttpClientConnection extends DefaultManagedHttpClientConnection {
-
- private final int chunkSize;
-
- private HttpClientConnection(final String id, final int buffersize, final int chunkSize) {
- super(id, buffersize);
-
- this.chunkSize = chunkSize;
- }
-
- @Override
- protected OutputStream createOutputStream(final long len, final SessionOutputBuffer outbuffer) {
- if (len == ContentLengthStrategy.CHUNKED) {
- return new ChunkedOutputStream(chunkSize, outbuffer);
- }
- return super.createOutputStream(len, outbuffer);
- }
- }
}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnectorProvider.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnectorProvider.java
index 77aecb2..f62bce7 100644
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnectorProvider.java
+++ b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/ApacheConnectorProvider.java
@@ -41,71 +41,14 @@
package org.eclipse.scout.rt.rest.jersey.client.connector;
import javax.ws.rs.client.Client;
-import javax.ws.rs.core.Configurable;
import javax.ws.rs.core.Configuration;
-import org.apache.http.client.CookieStore;
-import org.apache.http.client.HttpClient;
-import org.glassfish.jersey.client.Initializable;
import org.glassfish.jersey.client.spi.Connector;
import org.glassfish.jersey.client.spi.ConnectorProvider;
/**
* Connector provider for Jersey {@link Connector connectors} that utilize Apache HTTP Client to send and receive HTTP
* request and responses.
- * <p>
- * The following connector configuration properties are supported:
- * <ul>
- * <li>{@link ApacheClientProperties#CONNECTION_MANAGER}</li>
- * <li>{@link ApacheClientProperties#REQUEST_CONFIG}</li>
- * <li>{@link ApacheClientProperties#CREDENTIALS_PROVIDER}</li>
- * <li>{@link ApacheClientProperties#DISABLE_COOKIES}</li>
- * <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_URI}</li>
- * <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_USERNAME}</li>
- * <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_PASSWORD}</li>
- * <li>{@link org.glassfish.jersey.client.ClientProperties#REQUEST_ENTITY_PROCESSING} - default value is
- * {@link org.glassfish.jersey.client.RequestEntityProcessing#CHUNKED}</li>
- * <li>{@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}</li>
- * <li>{@link ApacheClientProperties#RETRY_HANDLER}</li>
- * </ul>
- * </p>
- * <p>
- * Connector instances created via this connector provider use
- * {@link org.glassfish.jersey.client.RequestEntityProcessing#CHUNKED chunked encoding} as a default setting. This can
- * be overridden by the {@link org.glassfish.jersey.client.ClientProperties#REQUEST_ENTITY_PROCESSING}. By default the
- * {@link org.glassfish.jersey.client.ClientProperties#CHUNKED_ENCODING_SIZE} property is only supported when using the
- * default {@code org.apache.http.conn.HttpClientConnectionManager} instance. If custom connection manager is used, then
- * chunked encoding size can be set by providing a custom {@code org.apache.http.HttpClientConnection} (via custom
- * {@code org.apache.http.impl.conn.ManagedHttpClientConnectionFactory}) and overriding it's {@code createOutputStream}
- * method.
- * </p>
- * <p>
- * Use of authorization by the AHC-based connectors is dependent on the chunk encoding setting. If the entity buffering
- * is enabled, the entity is buffered and authorization can be performed automatically in response to a 401 by sending
- * the request again. When entity buffering is disabled (chunked encoding is used) then the property
- * {@link org.glassfish.jersey.apache.connector.ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION} must be set to
- * {@code true}.
- * </p>
- * <p>
- * If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and an entity is not read from the response then
- * {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be called after processing the response to release
- * connection-based resources.
- * </p>
- * <p>
- * If a response entity is obtained that is an instance of {@link java.io.Closeable} then the instance MUST be closed
- * after processing the entity to release connection-based resources.
- * <p/>
- * <p>
- * The following methods are currently supported: HEAD, GET, POST, PUT, DELETE, OPTIONS, PATCH and TRACE.
- * <p/>
- *
- * @author Pavel Bucek (pavel.bucek at oracle.com)
- * @author Arul Dhesiaseelan (aruld at acm.org)
- * @author jorgeluisw at mac.com
- * @author Marek Potociar (marek.potociar at oracle.com)
- * @author Paul Sandoz
- * @author Maksim Mukosey (mmukosey at gmail.com)
- * @since 2.5
*/
public class ApacheConnectorProvider implements ConnectorProvider {
@@ -113,58 +56,4 @@
public Connector getConnector(final Client client, final Configuration runtimeConfig) {
return new ApacheConnector(client, runtimeConfig);
}
-
- /**
- * Retrieve the underlying Apache {@link HttpClient} instance from {@link org.glassfish.jersey.client.JerseyClient} or
- * {@link org.glassfish.jersey.client.JerseyWebTarget} configured to use {@code ApacheConnectorProvider}.
- *
- * @param component
- * {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use
- * {@code ApacheConnectorProvider}.
- * @return underlying Apache {@code HttpClient} instance.
- * @throws java.lang.IllegalArgumentException
- * in case the {@code component} is neither {@code JerseyClient} nor {@code JerseyWebTarget} instance or in
- * case the component is not configured to use a {@code ApacheConnectorProvider}.
- * @since 2.8
- */
- public static HttpClient getHttpClient(final Configurable<?> component) {
- return getConnector(component).getHttpClient();
- }
-
- /**
- * Retrieve the underlying Apache {@link CookieStore} instance from {@link org.glassfish.jersey.client.JerseyClient}
- * or {@link org.glassfish.jersey.client.JerseyWebTarget} configured to use {@code ApacheConnectorProvider}.
- *
- * @param component
- * {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use
- * {@code ApacheConnectorProvider}.
- * @return underlying Apache {@code CookieStore} instance.
- * @throws java.lang.IllegalArgumentException
- * in case the {@code component} is neither {@code JerseyClient} nor {@code JerseyWebTarget} instance or in
- * case the component is not configured to use a {@code ApacheConnectorProvider}.
- * @since 2.16
- */
- public static CookieStore getCookieStore(final Configurable<?> component) {
- return getConnector(component).getCookieStore();
- }
-
- private static ApacheConnector getConnector(final Configurable<?> component) {
- if (!(component instanceof Initializable)) {
- throw new IllegalArgumentException("INVALID_CONFIGURABLE_COMPONENT_TYPE");
- }
-
- final Initializable<?> initializable = (Initializable<?>) component;
- Connector connector = initializable.getConfiguration().getConnector();
- if (connector == null) {
- initializable.preInitialize();
- connector = initializable.getConfiguration().getConnector();
- }
-
- if (connector instanceof ApacheConnector) {
- return (ApacheConnector) connector;
- }
- else {
- throw new IllegalArgumentException("EXPECTED_CONNECTOR_PROVIDER_NOT_USED");
- }
- }
}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/RestClientHttpTransportManager.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/RestClientHttpTransportManager.java
new file mode 100644
index 0000000..2da41cf
--- /dev/null
+++ b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector/RestClientHttpTransportManager.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2019 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.rest.jersey.client.connector;
+
+import org.eclipse.scout.rt.shared.http.AbstractHttpTransportManager;
+
+public class RestClientHttpTransportManager extends AbstractHttpTransportManager {
+
+}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ApacheClientProperties.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ApacheClientProperties.java
deleted file mode 100644
index 291c456..0000000
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ApacheClientProperties.java
+++ /dev/null
@@ -1,166 +0,0 @@
-///*
-// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-// *
-// * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
-// *
-// * The contents of this file are subject to the terms of either the GNU
-// * General Public License Version 2 only ("GPL") or the Common Development
-// * and Distribution License("CDDL") (collectively, the "License"). You
-// * may not use this file except in compliance with the License. You can
-// * obtain a copy of the License at
-// * http://glassfish.java.net/public/CDDL+GPL_1_1.html
-// * or packager/legal/LICENSE.txt. See the License for the specific
-// * language governing permissions and limitations under the License.
-// *
-// * When distributing the software, include this License Header Notice in each
-// * file and include the License file at packager/legal/LICENSE.txt.
-// *
-// * GPL Classpath Exception:
-// * Oracle designates this particular file as subject to the "Classpath"
-// * exception as provided by Oracle in the GPL Version 2 section of the License
-// * file that accompanied this code.
-// *
-// * Modifications:
-// * If applicable, add the following below the License Header, with the fields
-// * enclosed by brackets [] replaced by your own identifying information:
-// * "Portions Copyright [year] [name of copyright owner]"
-// *
-// * Contributor(s):
-// * If you wish your version of this file to be governed by only the CDDL or
-// * only the GPL Version 2, indicate your decision by adding "[Contributor]
-// * elects to include this software in this distribution under the [CDDL or GPL
-// * Version 2] license." If you don't indicate a single choice of license, a
-// * recipient has the option to distribute your version of this file under
-// * either the CDDL, the GPL Version 2 or to extend the choice of license to
-// * its licensees as provided above. However, if you add GPL Version 2 code
-// * and therefore, elected the GPL Version 2 license, then the option applies
-// * only if the new code is made subject to such option by the copyright
-// * holder.
-// */
-//package org.eclipse.scout.rt.rest.jersey.client.connector_old;
-//
-//import org.glassfish.jersey.internal.util.PropertiesClass;
-//
-///**
-// * Configuration options specific to the Client API that utilizes {@link ScoutApacheConnectorProvider}.
-// *
-// * @author jorgeluisw@mac.com
-// * @author Paul Sandoz
-// * @author Pavel Bucek (pavel.bucek at oracle.com)
-// * @author Arul Dhesiaseelan (aruld at acm.org)
-// */
-//@PropertiesClass
-//public final class ApacheClientProperties {
-//
-// /**
-// * The credential provider that should be used to retrieve credentials from a user. Credentials needed for proxy
-// * authentication are stored here as well.
-// * <p/>
-// * The value MUST be an instance of {@link org.apache.http.client.CredentialsProvider}.
-// * <p/>
-// * If the property is absent a default provider will be used.
-// * <p/>
-// * The name of the configuration property is <tt>{@value}</tt>.
-// */
-// public static final String CREDENTIALS_PROVIDER = "jersey.config.apache.client.credentialsProvider";
-//
-// /**
-// * A value of {@code false} indicates the client should handle cookies automatically using HttpClient's default cookie
-// * policy. A value of {@code true} will cause the client to ignore all cookies.
-// * <p/>
-// * The value MUST be an instance of {@link java.lang.Boolean}.
-// * <p/>
-// * The default value is {@code false}.
-// * <p/>
-// * The name of the configuration property is <tt>{@value}</tt>.
-// */
-// public static final String DISABLE_COOKIES = "jersey.config.apache.client.handleCookies";
-//
-// /**
-// * A value of {@code true} indicates that a client should send an authentication request even before the server gives
-// * a 401 response.
-// * <p>
-// * This property may only be set prior to constructing Apache connector using {@link ScoutApacheConnectorProvider}.
-// * <p/>
-// * The value MUST be an instance of {@link java.lang.Boolean}.
-// * <p/>
-// * The default value is {@code false}.
-// * <p/>
-// * The name of the configuration property is <tt>{@value}</tt>.
-// */
-// public static final String PREEMPTIVE_BASIC_AUTHENTICATION = "jersey.config.apache.client.preemptiveBasicAuthentication";
-//
-// /**
-// * Connection Manager which will be used to create {@link org.apache.http.client.HttpClient}.
-// * <p/>
-// * The value MUST be an instance of {@link org.apache.http.conn.HttpClientConnectionManager}.
-// * <p/>
-// * If the property is absent a default Connection Manager will be used
-// * ({@link org.apache.http.impl.conn.BasicHttpClientConnectionManager}). If you want to use this client in
-// * multi-threaded environment, be sure you override default value with
-// * {@link org.apache.http.impl.conn.PoolingHttpClientConnectionManager} instance.
-// * <p/>
-// * The name of the configuration property is <tt>{@value}</tt>.
-// */
-// public static final String CONNECTION_MANAGER = "jersey.config.apache.client.connectionManager";
-//
-// /**
-// * A value of {@code true} indicates that configured connection manager should be shared among multiple Jersey
-// * {@link org.glassfish.jersey.client.ClientRuntime} instances. It means that closing a particular
-// * {@link org.glassfish.jersey.client.ClientRuntime} instance does not shut down the underlying connection manager
-// * automatically. In such case, the connection manager life-cycle should be fully managed by the application code. To
-// * release all allocated resources, caller code should especially ensure
-// * {@link org.apache.http.conn.HttpClientConnectionManager#shutdown()} gets invoked eventually.
-// * <p>
-// * This property may only be set prior to constructing Apache connector using {@link ScoutApacheConnectorProvider}.
-// * <p/>
-// * The value MUST be an instance of {@link java.lang.Boolean}.
-// * <p/>
-// * The default value is {@code false}.
-// * <p/>
-// * The name of the configuration property is <tt>{@value}</tt>.
-// *
-// * @since 2.18
-// */
-// public static final String CONNECTION_MANAGER_SHARED = "jersey.config.apache.client.connectionManagerShared";
-//
-// /**
-// * Request configuration for the {@link org.apache.http.client.HttpClient}. Http parameters which will be used to
-// * create {@link org.apache.http.client.HttpClient}.
-// * <p/>
-// * The value MUST be an instance of {@link org.apache.http.client.config.RequestConfig}.
-// * <p/>
-// * If the property is absent default request configuration will be used.
-// * <p/>
-// * The name of the configuration property is <tt>{@value}</tt>.
-// *
-// * @since 2.5
-// */
-// public static final String REQUEST_CONFIG = "jersey.config.apache.client.requestConfig";
-//
-//// /**
-//// * Get the value of the specified property. If the property is not set or the actual property value type is not
-//// * compatible with the specified type, the method will return {@code null}.
-//// *
-//// * @param properties
-//// * Map of properties to get the property value from.
-//// * @param key
-//// * Name of the property.
-//// * @param type
-//// * Type to retrieve the value as.
-//// * @param <T>
-//// * Type of the property value.
-//// * @return Value of the property or {@code null}.
-//// * @since 2.8
-//// */
-//// public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) {
-//// return PropertiesHelper.getValue(properties, key, type, null);
-//// }
-//
-// /**
-// * Prevents instantiation.
-// */
-// private ApacheClientProperties() {
-// throw new AssertionError("No instances allowed.");
-// }
-//}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/LocalizationMessages.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/LocalizationMessages.java
deleted file mode 100644
index 9761d71..0000000
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/LocalizationMessages.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.scout.rt.rest.jersey.client.connector_old;
-//
-//package org.eclipse.scout.rt.rest.jersey.client.connector;
-//
-//import org.glassfish.jersey.internal.l10n.Localizable;
-//import org.glassfish.jersey.internal.l10n.LocalizableMessageFactory;
-//import org.glassfish.jersey.internal.l10n.Localizer;
-//
-///**
-// * Defines string formatting method for each constant in the resource file
-// */
-//public final class LocalizationMessages {
-//
-// private final static LocalizableMessageFactory messageFactory = new LocalizableMessageFactory("org.glassfish.jersey.apache.connector.localization");
-// private final static Localizer localizer = new Localizer();
-//
-// public static Localizable localizableEXPECTED_CONNECTOR_PROVIDER_NOT_USED() {
-// return messageFactory.getMessage("expected.connector.provider.not.used");
-// }
-//
-// /**
-// * The supplied component is not configured to use a ApacheConnectorProvider.
-// */
-// public static String EXPECTED_CONNECTOR_PROVIDER_NOT_USED() {
-// return localizer.localize(localizableEXPECTED_CONNECTOR_PROVIDER_NOT_USED());
-// }
-//
-// public static Localizable localizableERROR_BUFFERING_ENTITY() {
-// return messageFactory.getMessage("error.buffering.entity");
-// }
-//
-// /**
-// * Error buffering the entity.
-// */
-// public static String ERROR_BUFFERING_ENTITY() {
-// return localizer.localize(localizableERROR_BUFFERING_ENTITY());
-// }
-//
-// public static Localizable localizableINVALID_CONFIGURABLE_COMPONENT_TYPE(Object arg0) {
-// return messageFactory.getMessage("invalid.configurable.component.type", arg0);
-// }
-//
-// /**
-// * The supplied component "{0}" is not assignable from JerseyClient or JerseyWebTarget.
-// */
-// public static String INVALID_CONFIGURABLE_COMPONENT_TYPE(Object arg0) {
-// return localizer.localize(localizableINVALID_CONFIGURABLE_COMPONENT_TYPE(arg0));
-// }
-//
-// public static Localizable localizableIGNORING_VALUE_OF_PROPERTY(Object arg0, Object arg1, Object arg2) {
-// return messageFactory.getMessage("ignoring.value.of.property", arg0, arg1, arg2);
-// }
-//
-// /**
-// * Ignoring value of property "{0}" ("{1}") - not instance of "{2}".
-// */
-// public static String IGNORING_VALUE_OF_PROPERTY(Object arg0, Object arg1, Object arg2) {
-// return localizer.localize(localizableIGNORING_VALUE_OF_PROPERTY(arg0, arg1, arg2));
-// }
-//
-// public static Localizable localizableWRONG_PROXY_URI_TYPE(Object arg0) {
-// return messageFactory.getMessage("wrong.proxy.uri.type", arg0);
-// }
-//
-// /**
-// * The proxy URI ("{0}") property MUST be an instance of String or URI.
-// */
-// public static String WRONG_PROXY_URI_TYPE(Object arg0) {
-// return localizer.localize(localizableWRONG_PROXY_URI_TYPE(arg0));
-// }
-//
-// public static Localizable localizableFAILED_TO_STOP_CLIENT() {
-// return messageFactory.getMessage("failed.to.stop.client");
-// }
-//
-// /**
-// * Failed to stop the client.
-// */
-// public static String FAILED_TO_STOP_CLIENT() {
-// return localizer.localize(localizableFAILED_TO_STOP_CLIENT());
-// }
-//
-//}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ScoutApacheConnector.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ScoutApacheConnector.java
deleted file mode 100644
index c339b24..0000000
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ScoutApacheConnector.java
+++ /dev/null
@@ -1,725 +0,0 @@
-///*
-// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-// *
-// * Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
-// *
-// * The contents of this file are subject to the terms of either the GNU
-// * General Public License Version 2 only ("GPL") or the Common Development
-// * and Distribution License("CDDL") (collectively, the "License"). You
-// * may not use this file except in compliance with the License. You can
-// * obtain a copy of the License at
-// * http://glassfish.java.net/public/CDDL+GPL_1_1.html
-// * or packager/legal/LICENSE.txt. See the License for the specific
-// * language governing permissions and limitations under the License.
-// *
-// * When distributing the software, include this License Header Notice in each
-// * file and include the License file at packager/legal/LICENSE.txt.
-// *
-// * GPL Classpath Exception:
-// * Oracle designates this particular file as subject to the "Classpath"
-// * exception as provided by Oracle in the GPL Version 2 section of the License
-// * file that accompanied this code.
-// *
-// * Modifications:
-// * If applicable, add the following below the License Header, with the fields
-// * enclosed by brackets [] replaced by your own identifying information:
-// * "Portions Copyright [year] [name of copyright owner]"
-// *
-// * Contributor(s):
-// * If you wish your version of this file to be governed by only the CDDL or
-// * only the GPL Version 2, indicate your decision by adding "[Contributor]
-// * elects to include this software in this distribution under the [CDDL or GPL
-// * Version 2] license." If you don't indicate a single choice of license, a
-// * recipient has the option to distribute your version of this file under
-// * either the CDDL, the GPL Version 2 or to extend the choice of license to
-// * its licensees as provided above. However, if you add GPL Version 2 code
-// * and therefore, elected the GPL Version 2 license, then the option applies
-// * only if the new code is made subject to such option by the copyright
-// * holder.
-// */
-//package org.eclipse.scout.rt.rest.jersey.client.connector_old;
-//
-//import java.io.BufferedInputStream;
-//import java.io.ByteArrayInputStream;
-//import java.io.ByteArrayOutputStream;
-//import java.io.FilterInputStream;
-//import java.io.IOException;
-//import java.io.InputStream;
-//import java.io.OutputStream;
-//import java.net.URI;
-//import java.util.ArrayList;
-//import java.util.List;
-//import java.util.Map;
-//import java.util.concurrent.Future;
-//
-//import javax.net.ssl.SSLContext;
-//import javax.ws.rs.ProcessingException;
-//import javax.ws.rs.client.Client;
-//import javax.ws.rs.core.Configuration;
-//import javax.ws.rs.core.HttpHeaders;
-//import javax.ws.rs.core.MultivaluedMap;
-//import javax.ws.rs.core.Response;
-//
-//import org.apache.http.Header;
-//import org.apache.http.HttpEntity;
-//import org.apache.http.HttpHost;
-//import org.apache.http.auth.AuthScope;
-//import org.apache.http.auth.UsernamePasswordCredentials;
-//import org.apache.http.client.AuthCache;
-//import org.apache.http.client.CookieStore;
-//import org.apache.http.client.CredentialsProvider;
-//import org.apache.http.client.config.CookieSpecs;
-//import org.apache.http.client.config.RequestConfig;
-//import org.apache.http.client.methods.CloseableHttpResponse;
-//import org.apache.http.client.methods.HttpUriRequest;
-//import org.apache.http.client.methods.RequestBuilder;
-//import org.apache.http.client.protocol.HttpClientContext;
-//import org.apache.http.conn.HttpClientConnectionManager;
-//import org.apache.http.entity.AbstractHttpEntity;
-//import org.apache.http.entity.BufferedHttpEntity;
-//import org.apache.http.impl.auth.BasicScheme;
-//import org.apache.http.impl.client.BasicAuthCache;
-//import org.apache.http.impl.client.BasicCookieStore;
-//import org.apache.http.impl.client.BasicCredentialsProvider;
-//import org.apache.http.impl.client.CloseableHttpClient;
-//import org.apache.http.impl.client.HttpClientBuilder;
-//import org.eclipse.scout.rt.platform.config.CONFIG;
-//import org.eclipse.scout.rt.platform.config.PlatformConfigProperties.ApplicationVersionProperty;
-//import org.eclipse.scout.rt.platform.context.RunMonitor;
-//import org.eclipse.scout.rt.platform.util.Assertions;
-//import org.eclipse.scout.rt.platform.util.concurrent.ICancellable;
-//import org.glassfish.jersey.client.ClientProperties;
-//import org.glassfish.jersey.client.ClientRequest;
-//import org.glassfish.jersey.client.ClientResponse;
-//import org.glassfish.jersey.client.RequestEntityProcessing;
-//import org.glassfish.jersey.client.spi.AsyncConnectorCallback;
-//import org.glassfish.jersey.client.spi.Connector;
-//import org.glassfish.jersey.internal.util.PropertiesHelper;
-//import org.glassfish.jersey.message.internal.HeaderUtils;
-//import org.glassfish.jersey.message.internal.OutboundMessageContext;
-//import org.glassfish.jersey.message.internal.ReaderWriter;
-//import org.glassfish.jersey.message.internal.Statuses;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import jersey.repackaged.com.google.common.util.concurrent.MoreExecutors;
-//
-/////**
-//// * A {@link Connector} that utilizes the Apache HTTP Client to send and receive HTTP request and responses.
-//// * <p/>
-//// * The following properties are only supported at construction of this class:
-//// * <ul>
-//// * <li>{@link ApacheClientProperties#CONNECTION_MANAGER}</li>
-//// * <li>{@link ApacheClientProperties#REQUEST_CONFIG}</li>
-//// * <li>{@link ApacheClientProperties#CREDENTIALS_PROVIDER}</li>
-//// * <li>{@link ApacheClientProperties#DISABLE_COOKIES}</li>
-//// * <li>{@link ClientProperties#PROXY_URI}</li>
-//// * <li>{@link ClientProperties#PROXY_USERNAME}</li>
-//// * <li>{@link ClientProperties#PROXY_PASSWORD}</li>
-//// * <li>{@link ClientProperties#REQUEST_ENTITY_PROCESSING} - default value is
-//// * {@link RequestEntityProcessing#CHUNKED}</li>
-//// * <li>{@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}</li>
-//// * </ul>
-//// * <p>
-//// * This connector uses {@link RequestEntityProcessing#CHUNKED chunked encoding} as a default setting. This can be
-//// * overridden by the {@link ClientProperties#REQUEST_ENTITY_PROCESSING}. By default the
-//// * {@link ClientProperties#CHUNKED_ENCODING_SIZE} property is only supported by using default connection manager. If
-//// * custom connection manager needs to be used then chunked encoding size can be set by providing a custom
-//// * {@link org.apache.http.HttpClientConnection} (via custom
-//// * {@link org.apache.http.impl.conn.ManagedHttpClientConnectionFactory}) and overriding {@code createOutputStream}
-//// * method.
-//// * </p>
-//// * <p>
-//// * Using of authorization is dependent on the chunk encoding setting. If the entity buffering is enabled, the entity is
-//// * buffered and authorization can be performed automatically in response to a 401 by sending the request again. When
-//// * entity buffering is disabled (chunked encoding is used) then the property
-//// * {@link org.glassfish.jersey.apache.connector.ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION} must be set to
-//// * {@code true}.
-//// * </p>
-//// * <p>
-//// * If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and an entity is not read from the response then
-//// * {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be called after processing the response to release
-//// * connection-based resources.
-//// * </p>
-//// * <p>
-//// * Client operations are thread safe, the HTTP connection may be shared between different threads.
-//// * </p>
-//// * <p>
-//// * If a response entity is obtained that is an instance of {@link Closeable} then the instance MUST be closed after
-//// * processing the entity to release connection-based resources.
-//// * </p>
-//// * <p>
-//// * The following methods are currently supported: HEAD, GET, POST, PUT, DELETE, OPTIONS, PATCH and TRACE.
-//// * </p>
-//// *
-//// * @author jorgeluisw@mac.com
-//// * @author Paul Sandoz
-//// * @author Pavel Bucek (pavel.bucek at oracle.com)
-//// * @author Arul Dhesiaseelan (aruld at acm.org)
-//// * @see ApacheClientProperties#CONNECTION_MANAGER
-//// */
-////@SuppressWarnings("deprecation")
-//public class ScoutApacheConnector implements Connector {
-//
-//// private static final Logger LOGGER = Logger.getLogger(ScoutApacheConnector.class.getName());
-//
-// private static final Logger LOG = LoggerFactory.getLogger(ScoutApacheConnector.class);
-//
-//// private static final VersionInfo vi;
-//// private static final String release;
-//
-//// static {
-//// vi = VersionInfo.loadVersionInfo("org.apache.http.client", HttpClientBuilder.class.getClassLoader());
-//// release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
-//// }
-//
-// private final CloseableHttpClient m_client;
-// private final CookieStore m_cookieStore;
-// private final boolean m_preemptiveBasicAuth;
-// private final RequestConfig m_requestConfig;
-//
-// /**
-// * Create the new Apache HTTP Client connector.
-// *
-// * @param client
-// * JAX-RS client instance for which the connector is being created.
-// * @param config
-// * client configuration.
-// */
-// ScoutApacheConnector(final Client client, final Configuration config) {
-//// final Object connectionManager = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER);
-//// if (connectionManager != null) {
-//// if (!(connectionManager instanceof HttpClientConnectionManager)) {
-//// LOGGER.log(
-//// Level.WARNING,
-//// LocalizationMessages.IGNORING_VALUE_OF_PROPERTY(
-//// ApacheClientProperties.CONNECTION_MANAGER,
-//// connectionManager.getClass().getName(),
-//// HttpClientConnectionManager.class.getName()));
-//// }
-//// }
-//
-// Object reqConfig = config.getProperties().get(ApacheClientProperties.REQUEST_CONFIG);
-// if (reqConfig != null) {
-// if (!(reqConfig instanceof RequestConfig)) {
-// LOG.warn("ignoring value of property");
-//
-//// LOGGER.log(
-//// Level.WARNING,
-//// LocalizationMessages.IGNORING_VALUE_OF_PROPERTY(
-//// ApacheClientProperties.REQUEST_CONFIG,
-//// reqConfig.getClass().getName(),
-//// RequestConfig.class.getName()));
-// reqConfig = null;
-// }
-// }
-//
-// final SSLContext sslContext = client.getSslContext();
-// final HttpClientBuilder clientBuilder = HttpClientBuilder.create();
-//
-// clientBuilder.setConnectionManager(getConnectionManager(client, config, sslContext));
-// clientBuilder.setConnectionManagerShared(
-// PropertiesHelper.getValue(config.getProperties(), ApacheClientProperties.CONNECTION_MANAGER_SHARED, false, null));
-// clientBuilder.setSSLContext(sslContext);
-//
-// final RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
-//
-// final Object credentialsProvider = config.getProperty(ApacheClientProperties.CREDENTIALS_PROVIDER);
-// if (credentialsProvider != null && (credentialsProvider instanceof CredentialsProvider)) {
-// clientBuilder.setDefaultCredentialsProvider((CredentialsProvider) credentialsProvider);
-// }
-//
-// final Object proxyUri;
-// proxyUri = config.getProperty(ClientProperties.PROXY_URI);
-// if (proxyUri != null) {
-// final URI u = getProxyUri(proxyUri);
-// final HttpHost proxy = new HttpHost(u.getHost(), u.getPort(), u.getScheme());
-// final String userName;
-// userName = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_USERNAME, String.class);
-// if (userName != null) {
-// final String password;
-// password = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_PASSWORD, String.class);
-//
-// if (password != null) {
-// final CredentialsProvider credsProvider = new BasicCredentialsProvider();
-// credsProvider.setCredentials(
-// new AuthScope(u.getHost(), u.getPort()),
-// new UsernamePasswordCredentials(userName, password));
-// clientBuilder.setDefaultCredentialsProvider(credsProvider);
-// }
-// }
-// clientBuilder.setProxy(proxy);
-// }
-//
-// final Boolean preemptiveBasicAuthProperty = (Boolean) config.getProperties()
-// .get(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION);
-// this.m_preemptiveBasicAuth = (preemptiveBasicAuthProperty != null) ? preemptiveBasicAuthProperty : false;
-//
-// final boolean ignoreCookies = PropertiesHelper.isProperty(config.getProperties(), ApacheClientProperties.DISABLE_COOKIES);
-//
-// if (reqConfig != null) {
-// final RequestConfig.Builder reqConfigBuilder = RequestConfig.copy((RequestConfig) reqConfig);
-// if (ignoreCookies) {
-// reqConfigBuilder.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
-// }
-// m_requestConfig = reqConfigBuilder.build();
-// }
-// else {
-// if (ignoreCookies) {
-// requestConfigBuilder.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
-// }
-// m_requestConfig = requestConfigBuilder.build();
-// }
-//
-// if (m_requestConfig.getCookieSpec() == null || !m_requestConfig.getCookieSpec().equals(CookieSpecs.IGNORE_COOKIES)) {
-// this.m_cookieStore = new BasicCookieStore();
-// clientBuilder.setDefaultCookieStore(m_cookieStore);
-// }
-// else {
-// this.m_cookieStore = null;
-// }
-// clientBuilder.setDefaultRequestConfig(m_requestConfig);
-// this.m_client = clientBuilder.build();
-// }
-//
-// private HttpClientConnectionManager getConnectionManager(final Client client,
-// final Configuration config,
-// final SSLContext sslContext) {
-// final Object cmObject = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER);
-//
-// return Assertions.assertType(cmObject, HttpClientConnectionManager.class);
-//
-// // Connection manager from configuration.
-//// if (cmObject != null) {
-//// if (cmObject instanceof HttpClientConnectionManager) {
-//// return (HttpClientConnectionManager) cmObject;
-//// }
-//// else {
-//// LOGGER.log(
-//// Level.WARNING,
-//// LocalizationMessages.IGNORING_VALUE_OF_PROPERTY(
-//// ApacheClientProperties.CONNECTION_MANAGER,
-//// cmObject.getClass().getName(),
-//// HttpClientConnectionManager.class.getName()));
-//// }
-//// }
-//
-// // Create custom connection manager.
-//// return createConnectionManager(
-//// client,
-//// config,
-//// sslContext,
-//// false);
-// }
-//
-//// private HttpClientConnectionManager createConnectionManager(
-//// final Client client,
-//// final Configuration config,
-//// final SSLContext sslContext,
-//// final boolean useSystemProperties) {
-////
-//// final String[] supportedProtocols = useSystemProperties ? split(
-//// System.getProperty("https.protocols")) : null;
-//// final String[] supportedCipherSuites = useSystemProperties ? split(
-//// System.getProperty("https.cipherSuites")) : null;
-////
-//// HostnameVerifier hostnameVerifier = client.getHostnameVerifier();
-////
-//// final LayeredConnectionSocketFactory sslSocketFactory;
-//// if (sslContext != null) {
-//// sslSocketFactory = new SSLConnectionSocketFactory(
-//// sslContext, supportedProtocols, supportedCipherSuites, hostnameVerifier);
-//// }
-//// else {
-//// if (useSystemProperties) {
-//// sslSocketFactory = new SSLConnectionSocketFactory(
-//// (SSLSocketFactory) SSLSocketFactory.getDefault(),
-//// supportedProtocols, supportedCipherSuites, hostnameVerifier);
-//// }
-//// else {
-//// sslSocketFactory = new SSLConnectionSocketFactory(
-//// SSLContexts.createDefault(),
-//// hostnameVerifier);
-//// }
-//// }
-////
-//// final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory> create()
-//// .register("http", PlainConnectionSocketFactory.getSocketFactory())
-//// .register("https", sslSocketFactory)
-//// .build();
-////
-//// final Integer chunkSize = ClientProperties.getValue(config.getProperties(),
-//// ClientProperties.CHUNKED_ENCODING_SIZE, ClientProperties.DEFAULT_CHUNK_SIZE, Integer.class);
-////
-//// final PoolingHttpClientConnectionManager connectionManager =
-//// new PoolingHttpClientConnectionManager(registry, new ConnectionFactory(chunkSize));
-////
-//// if (useSystemProperties) {
-//// String s = System.getProperty("http.keepAlive", "true");
-//// if ("true".equalsIgnoreCase(s)) {
-//// s = System.getProperty("http.maxConnections", "5");
-//// final int max = Integer.parseInt(s);
-//// connectionManager.setDefaultMaxPerRoute(max);
-//// connectionManager.setMaxTotal(2 * max);
-//// }
-//// }
-////
-//// return connectionManager;
-//// }
-//
-//// private static String[] split(final String s) {
-//// if (TextUtils.isBlank(s)) {
-//// return null;
-//// }
-//// return s.split(" *, *");
-//// }
-//
-//// /**
-//// * Get the {@link HttpClient}.
-//// *
-//// * @return the {@link HttpClient}.
-//// */
-//// @SuppressWarnings("UnusedDeclaration")
-//// public HttpClient getHttpClient() {
-//// return client;
-//// }
-//
-//// /**
-//// * Get the {@link CookieStore}.
-//// *
-//// * @return the {@link CookieStore} instance or {@code null} when {@value ApacheClientProperties#DISABLE_COOKIES} set
-//// * to {@code true}.
-//// */
-//// public CookieStore getCookieStore() {
-//// return cookieStore;
-//// }
-//
-// private static URI getProxyUri(final Object proxy) {
-// if (proxy instanceof URI) {
-// return (URI) proxy;
-// }
-// else if (proxy instanceof String) {
-// return URI.create((String) proxy);
-// }
-// else {
-// throw new ProcessingException("WRONG_PROXY_URI_TYPE" /*LocalizationMessages.WRONG_PROXY_URI_TYPE(ClientProperties.PROXY_URI)*/);
-// }
-// }
-//
-// @Override
-// public ClientResponse apply(final ClientRequest clientRequest) {
-// final HttpUriRequest request = getUriHttpRequest(clientRequest);
-// final Map<String, String> clientHeadersSnapshot = writeOutBoundHeaders(clientRequest.getHeaders(), request);
-//
-// registerCancellable(request);
-//
-// try {
-// final CloseableHttpResponse response;
-// final HttpClientContext context = HttpClientContext.create();
-// if (m_preemptiveBasicAuth) {
-// final AuthCache authCache = new BasicAuthCache();
-// final BasicScheme basicScheme = new BasicScheme();
-// authCache.put(getHost(request), basicScheme);
-// context.setAuthCache(authCache);
-// }
-// response = m_client.execute(getHost(request), request, context);
-// HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, clientRequest.getHeaders(), this.getClass().getName());
-//
-// final Response.StatusType status = response.getStatusLine().getReasonPhrase() == null
-// ? Statuses.from(response.getStatusLine().getStatusCode())
-// : Statuses.from(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase());
-//
-// final ClientResponse responseContext = new ClientResponse(status, clientRequest);
-// final List<URI> redirectLocations = context.getRedirectLocations();
-// if (redirectLocations != null && !redirectLocations.isEmpty()) {
-// responseContext.setResolvedRequestUri(redirectLocations.get(redirectLocations.size() - 1));
-// }
-//
-// final Header[] respHeaders = response.getAllHeaders();
-// final MultivaluedMap<String, String> headers = responseContext.getHeaders();
-// for (final Header header : respHeaders) {
-// final String headerName = header.getName();
-// List<String> list = headers.get(headerName);
-// if (list == null) {
-// list = new ArrayList<>();
-// }
-// list.add(header.getValue());
-// headers.put(headerName, list);
-// }
-//
-// final HttpEntity entity = response.getEntity();
-//
-// if (entity != null) {
-// if (headers.get(HttpHeaders.CONTENT_LENGTH) == null) {
-// headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getContentLength()));
-// }
-//
-// final Header contentEncoding = entity.getContentEncoding();
-// if (headers.get(HttpHeaders.CONTENT_ENCODING) == null && contentEncoding != null) {
-// headers.add(HttpHeaders.CONTENT_ENCODING, contentEncoding.getValue());
-// }
-// }
-//
-// try {
-// responseContext.setEntityStream(new HttpClientResponseInputStream(getInputStream(response)));
-// }
-// catch (final IOException e) {
-//// LOGGER.log(Level.SEVERE, null, e);
-// LOG.error("apply failed", e);
-// }
-//
-// return responseContext;
-// }
-// catch (final Exception e) {
-// throw new ProcessingException(e);
-// }
-// }
-//
-// /**
-// * Registers an {@link ICancellable} if this method is invoked in the context of a {@link RunMonitor} (i.e.
-// * {@link RunMonitor#CURRENT} is not {@code null}).
-// */
-// protected void registerCancellable(final HttpUriRequest request) {
-// RunMonitor runMonitor = RunMonitor.CURRENT.get();
-// if (runMonitor != null) {
-// runMonitor.registerCancellable(new ICancellable() {
-//
-// @Override
-// public boolean isCancelled() {
-// return request.isAborted();
-// }
-//
-// @Override
-// public boolean cancel(boolean interruptIfRunning) {
-//// LOGGER.fine("Aborting HTTP REST request");
-// LOG.debug("Aborting HTTP REST request");
-// request.abort();
-// return true;
-// }
-// });
-// }
-// }
-//
-// @Override
-// public Future<?> apply(final ClientRequest request, final AsyncConnectorCallback callback) {
-// return MoreExecutors.sameThreadExecutor().submit(new Runnable() {
-// @Override
-// public void run() {
-// try {
-// callback.response(apply(request));
-// }
-// catch (final Throwable t) {
-// callback.failure(t);
-// }
-// }
-// });
-// }
-//
-// @Override
-// public String getName() {
-// return "Apache HttpClient " + CONFIG.getPropertyValue(ApplicationVersionProperty.class); //release;
-// }
-//
-// @Override
-// public void close() {
-// try {
-// m_client.close();
-// }
-// catch (final IOException e) {
-// throw new ProcessingException("FAILED_TO_STOP_CLIENT" /*LocalizationMessages.FAILED_TO_STOP_CLIENT()*/, e);
-// }
-// }
-//
-// private HttpHost getHost(final HttpUriRequest request) {
-// return new HttpHost(request.getURI().getHost(), request.getURI().getPort(), request.getURI().getScheme());
-// }
-//
-// private HttpUriRequest getUriHttpRequest(final ClientRequest clientRequest) {
-// final RequestConfig.Builder requestConfigBuilder = RequestConfig.copy(m_requestConfig);
-//
-// final int connectTimeout = clientRequest.resolveProperty(ClientProperties.CONNECT_TIMEOUT, -1);
-// final int socketTimeout = clientRequest.resolveProperty(ClientProperties.READ_TIMEOUT, -1);
-//
-// if (connectTimeout >= 0) {
-// requestConfigBuilder.setConnectTimeout(connectTimeout);
-// }
-// if (socketTimeout >= 0) {
-// requestConfigBuilder.setSocketTimeout(socketTimeout);
-// }
-//
-// final Boolean redirectsEnabled =
-// clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, m_requestConfig.isRedirectsEnabled());
-// requestConfigBuilder.setRedirectsEnabled(redirectsEnabled);
-//
-// final Boolean bufferingEnabled = clientRequest.resolveProperty(ClientProperties.REQUEST_ENTITY_PROCESSING,
-// RequestEntityProcessing.class) == RequestEntityProcessing.BUFFERED;
-// final HttpEntity entity = getHttpEntity(clientRequest, bufferingEnabled);
-//
-// return RequestBuilder
-// .create(clientRequest.getMethod())
-// .setUri(clientRequest.getUri())
-// .setConfig(requestConfigBuilder.build())
-// .setEntity(entity)
-// .build();
-// }
-//
-// private HttpEntity getHttpEntity(final ClientRequest clientRequest, final boolean bufferingEnabled) {
-// final Object entity = clientRequest.getEntity();
-//
-// if (entity == null) {
-// return null;
-// }
-//
-// final AbstractHttpEntity httpEntity = new AbstractHttpEntity() {
-// @Override
-// public boolean isRepeatable() {
-// return false;
-// }
-//
-// @Override
-// public long getContentLength() {
-// return -1;
-// }
-//
-// @Override
-// public InputStream getContent() throws IOException, IllegalStateException {
-// if (bufferingEnabled) {
-// final ByteArrayOutputStream buffer = new ByteArrayOutputStream(512);
-// writeTo(buffer);
-// return new ByteArrayInputStream(buffer.toByteArray());
-// }
-// else {
-// return null;
-// }
-// }
-//
-// @Override
-// public void writeTo(final OutputStream outputStream) throws IOException {
-// clientRequest.setStreamProvider(new OutboundMessageContext.StreamProvider() {
-// @Override
-// public OutputStream getOutputStream(final int contentLength) throws IOException {
-// return outputStream;
-// }
-// });
-// clientRequest.writeEntity();
-// }
-//
-// @Override
-// public boolean isStreaming() {
-// return false;
-// }
-// };
-//
-// if (bufferingEnabled) {
-// try {
-// return new BufferedHttpEntity(httpEntity);
-// }
-// catch (final IOException e) {
-// throw new ProcessingException("ERROR_BUFFERING_ENTITY" /*LocalizationMessages.ERROR_BUFFERING_ENTITY()*/, e);
-// }
-// }
-// else {
-// return httpEntity;
-// }
-// }
-//
-// private static Map<String, String> writeOutBoundHeaders(final MultivaluedMap<String, Object> headers,
-// final HttpUriRequest request) {
-// final Map<String, String> stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers);
-//
-// for (final Map.Entry<String, String> e : stringHeaders.entrySet()) {
-// request.addHeader(e.getKey(), e.getValue());
-// }
-// return stringHeaders;
-// }
-//
-// private static final class HttpClientResponseInputStream extends FilterInputStream {
-//
-// HttpClientResponseInputStream(final InputStream inputStream) throws IOException {
-// super(inputStream);
-// }
-//
-// @Override
-// public void close() throws IOException {
-// super.close();
-// }
-// }
-//
-// private static InputStream getInputStream(final CloseableHttpResponse response) throws IOException {
-//
-// final InputStream inputStream;
-//
-// if (response.getEntity() == null) {
-// inputStream = new ByteArrayInputStream(new byte[0]);
-// }
-// else {
-// final InputStream i = response.getEntity().getContent();
-// if (i.markSupported()) {
-// inputStream = i;
-// }
-// else {
-// inputStream = new BufferedInputStream(i, ReaderWriter.BUFFER_SIZE);
-// }
-// }
-//
-// return new FilterInputStream(inputStream) {
-// @Override
-// public void close() throws IOException {
-// try {
-// super.close();
-// }
-// catch (@SuppressWarnings("squid:S1166") IOException ex) {
-// // Ignore
-// }
-// finally {
-// response.close();
-// }
-// }
-// };
-//
-//// return new FilterInputStream(inputStream) {
-//// @Override
-//// public void close() throws IOException {
-//// response.close();
-//// super.close();
-//// }
-//// };
-// }
-//
-//// private static class ConnectionFactory extends ManagedHttpClientConnectionFactory {
-////
-//// private static final AtomicLong COUNTER = new AtomicLong();
-////
-//// private final int chunkSize;
-////
-//// private ConnectionFactory(final int chunkSize) {
-//// this.chunkSize = chunkSize;
-//// }
-////
-//// @Override
-//// public ManagedHttpClientConnection create(final HttpRoute route, final ConnectionConfig config) {
-//// final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement());
-////
-//// return new HttpClientConnection(id, config.getBufferSize(), chunkSize);
-//// }
-//// }
-//
-//// private static class HttpClientConnection extends DefaultManagedHttpClientConnection {
-////
-//// private final int chunkSize;
-////
-//// private HttpClientConnection(final String id, final int buffersize, final int chunkSize) {
-//// super(id, buffersize);
-////
-//// this.chunkSize = chunkSize;
-//// }
-////
-//// @Override
-//// protected OutputStream createOutputStream(final long len, final SessionOutputBuffer outbuffer) {
-//// if (len == ContentLengthStrategy.CHUNKED) {
-//// return new ChunkedOutputStream(chunkSize, outbuffer);
-//// }
-//// return super.createOutputStream(len, outbuffer);
-//// }
-//// }
-//}
diff --git a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ScoutApacheConnectorProvider.java b/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ScoutApacheConnectorProvider.java
deleted file mode 100644
index 8fddb14..0000000
--- a/org.eclipse.scout.rt.rest.jersey.client/src/main/java/org/eclipse/scout/rt/rest/jersey/client/connector_old/ScoutApacheConnectorProvider.java
+++ /dev/null
@@ -1,166 +0,0 @@
-///*
-// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-// *
-// * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
-// *
-// * The contents of this file are subject to the terms of either the GNU
-// * General Public License Version 2 only ("GPL") or the Common Development
-// * and Distribution License("CDDL") (collectively, the "License"). You
-// * may not use this file except in compliance with the License. You can
-// * obtain a copy of the License at
-// * http://glassfish.java.net/public/CDDL+GPL_1_1.html
-// * or packager/legal/LICENSE.txt. See the License for the specific
-// * language governing permissions and limitations under the License.
-// *
-// * When distributing the software, include this License Header Notice in each
-// * file and include the License file at packager/legal/LICENSE.txt.
-// *
-// * GPL Classpath Exception:
-// * Oracle designates this particular file as subject to the "Classpath"
-// * exception as provided by Oracle in the GPL Version 2 section of the License
-// * file that accompanied this code.
-// *
-// * Modifications:
-// * If applicable, add the following below the License Header, with the fields
-// * enclosed by brackets [] replaced by your own identifying information:
-// * "Portions Copyright [year] [name of copyright owner]"
-// *
-// * Contributor(s):
-// * If you wish your version of this file to be governed by only the CDDL or
-// * only the GPL Version 2, indicate your decision by adding "[Contributor]
-// * elects to include this software in this distribution under the [CDDL or GPL
-// * Version 2] license." If you don't indicate a single choice of license, a
-// * recipient has the option to distribute your version of this file under
-// * either the CDDL, the GPL Version 2 or to extend the choice of license to
-// * its licensees as provided above. However, if you add GPL Version 2 code
-// * and therefore, elected the GPL Version 2 license, then the option applies
-// * only if the new code is made subject to such option by the copyright
-// * holder.
-// */
-//package org.eclipse.scout.rt.rest.jersey.client.connector_old;
-//
-//import javax.ws.rs.client.Client;
-//import javax.ws.rs.core.Configuration;
-//
-//import org.glassfish.jersey.client.spi.Connector;
-//import org.glassfish.jersey.client.spi.ConnectorProvider;
-//
-/////**
-//// * Connector provider for Jersey {@link Connector connectors} that utilize Apache HTTP Client to send and receive HTTP
-//// * request and responses.
-//// * <p>
-//// * The following connector configuration properties are supported:
-//// * <ul>
-//// * <li>{@link ApacheClientProperties#CONNECTION_MANAGER}</li>
-//// * <li>{@link ApacheClientProperties#REQUEST_CONFIG}</li>
-//// * <li>{@link ApacheClientProperties#CREDENTIALS_PROVIDER}</li>
-//// * <li>{@link ApacheClientProperties#DISABLE_COOKIES}</li>
-//// * <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_URI}</li>
-//// * <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_USERNAME}</li>
-//// * <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_PASSWORD}</li>
-//// * <li>{@link org.glassfish.jersey.client.ClientProperties#REQUEST_ENTITY_PROCESSING} - default value is
-//// * {@link org.glassfish.jersey.client.RequestEntityProcessing#CHUNKED}</li>
-//// * <li>{@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}</li>
-//// * </ul>
-//// * </p>
-//// * <p>
-//// * Connector instances created via this connector provider use
-//// * {@link org.glassfish.jersey.client.RequestEntityProcessing#CHUNKED chunked encoding} as a default setting. This can
-//// * be overridden by the {@link org.glassfish.jersey.client.ClientProperties#REQUEST_ENTITY_PROCESSING}. By default the
-//// * {@link org.glassfish.jersey.client.ClientProperties#CHUNKED_ENCODING_SIZE} property is only supported when using the
-//// * default {@code org.apache.http.conn.HttpClientConnectionManager} instance. If custom connection manager is used, then
-//// * chunked encoding size can be set by providing a custom {@code org.apache.http.HttpClientConnection} (via custom
-//// * {@code org.apache.http.impl.conn.ManagedHttpClientConnectionFactory}) and overriding it's {@code createOutputStream}
-//// * method.
-//// * </p>
-//// * <p>
-//// * Use of authorization by the AHC-based connectors is dependent on the chunk encoding setting. If the entity buffering
-//// * is enabled, the entity is buffered and authorization can be performed automatically in response to a 401 by sending
-//// * the request again. When entity buffering is disabled (chunked encoding is used) then the property
-//// * {@link org.glassfish.jersey.apache.connector.ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION} must be set to
-//// * {@code true}.
-//// * </p>
-//// * <p>
-//// * If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and an entity is not read from the response then
-//// * {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be called after processing the response to release
-//// * connection-based resources.
-//// * </p>
-//// * <p>
-//// * If a response entity is obtained that is an instance of {@link java.io.Closeable} then the instance MUST be closed
-//// * after processing the entity to release connection-based resources.
-//// * <p/>
-//// * <p>
-//// * The following methods are currently supported: HEAD, GET, POST, PUT, DELETE, OPTIONS, PATCH and TRACE.
-//// * <p/>
-//// *
-//// * @author Pavel Bucek (pavel.bucek at oracle.com)
-//// * @author Arul Dhesiaseelan (aruld at acm.org)
-//// * @author jorgeluisw at mac.com
-//// * @author Marek Potociar (marek.potociar at oracle.com)
-//// * @author Paul Sandoz
-//// * @author Maksim Mukosey (mmukosey at gmail.com)
-//// * @since 2.5
-//// */
-//public class ScoutApacheConnectorProvider implements ConnectorProvider {
-//
-// @Override
-// public Connector getConnector(final Client client, final Configuration runtimeConfig) {
-//// return new ApacheConnector(client, runtimeConfig);
-// return new ScoutApacheConnector(client, runtimeConfig);
-// }
-//
-//// /**
-//// * Retrieve the underlying Apache {@link HttpClient} instance from {@link org.glassfish.jersey.client.JerseyClient} or
-//// * {@link org.glassfish.jersey.client.JerseyWebTarget} configured to use {@code ApacheConnectorProvider}.
-//// *
-//// * @param component
-//// * {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use
-//// * {@code ApacheConnectorProvider}.
-//// * @return underlying Apache {@code HttpClient} instance.
-//// * @throws java.lang.IllegalArgumentException
-//// * in case the {@code component} is neither {@code JerseyClient} nor {@code JerseyWebTarget} instance or in
-//// * case the component is not configured to use a {@code ApacheConnectorProvider}.
-//// * @since 2.8
-//// */
-//// public static HttpClient getHttpClient(final Configurable<?> component) {
-//// return getConnector(component).getHttpClient();
-//// }
-//
-//// /**
-//// * Retrieve the underlying Apache {@link CookieStore} instance from {@link org.glassfish.jersey.client.JerseyClient}
-//// * or {@link org.glassfish.jersey.client.JerseyWebTarget} configured to use {@code ApacheConnectorProvider}.
-//// *
-//// * @param component
-//// * {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use
-//// * {@code ApacheConnectorProvider}.
-//// * @return underlying Apache {@code CookieStore} instance.
-//// * @throws java.lang.IllegalArgumentException
-//// * in case the {@code component} is neither {@code JerseyClient} nor {@code JerseyWebTarget} instance or in
-//// * case the component is not configured to use a {@code ApacheConnectorProvider}.
-//// * @since 2.16
-//// */
-//// public static CookieStore getCookieStore(final Configurable<?> component) {
-//// return getConnector(component).getCookieStore();
-//// }
-//
-//// private static ApacheConnector getConnector(final Configurable<?> component) {
-//// if (!(component instanceof Initializable)) {
-//// throw new IllegalArgumentException(
-//// LocalizationMessages.INVALID_CONFIGURABLE_COMPONENT_TYPE(component.getClass().getName()));
-//// }
-////
-//// final Initializable<?> initializable = (Initializable<?>) component;
-//// Connector connector = initializable.getConfiguration().getConnector();
-//// if (connector == null) {
-//// initializable.preInitialize();
-//// connector = initializable.getConfiguration().getConnector();
-//// }
-////
-//// if (connector instanceof ApacheConnector) {
-//// return (ApacheConnector) connector;
-//// }
-//// else {
-//// throw new IllegalArgumentException(LocalizationMessages.EXPECTED_CONNECTOR_PROVIDER_NOT_USED());
-//// }
-//// }
-//}