use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class MultipartMixedWithApacheClientTest method configureClient.
@Override
protected void configureClient(ClientConfig config) {
config.connectorProvider(new ApacheConnectorProvider());
config.register(MultiPartFeature.class);
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class SslConnectorConfigurationTest method testSSLAuth1.
/**
* Test to see that SSLHandshakeException is thrown when client don't have
* trusted key.
*
* @throws Exception in case of a test failure.
*/
@Test
public void testSSLAuth1() throws Exception {
final SSLContext sslContext = getSslContext();
final ClientConfig cc = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
final Client client = ClientBuilder.newBuilder().withConfig(cc).sslContext(sslContext).build();
WebTarget target = client.target(Server.BASE_URI).register(LoggingFeature.class);
boolean caught = false;
try {
target.path("/").request().get(String.class);
} catch (Exception e) {
caught = true;
}
assertTrue(caught);
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class Jersey2878ApacheITCase method configureClient.
@Override
protected void configureClient(final ClientConfig config) {
config.connectorProvider(new ApacheConnectorProvider());
super.configureClient(config);
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project storm by apache.
the class OpenTsdbClient method init.
private void init() {
final ApacheConnectorProvider apacheConnectorProvider = new ApacheConnectorProvider();
final ClientConfig clientConfig = new ClientConfig().connectorProvider(apacheConnectorProvider);
// transfer encoding should be set as jersey sets it on by default.
clientConfig.property(ClientProperties.REQUEST_ENTITY_PROCESSING, enableChunkedEncoding ? RequestEntityProcessing.CHUNKED : RequestEntityProcessing.BUFFERED);
client = ClientBuilder.newClient(clientConfig);
target = client.target(urlString).path(PUT_PATH);
if (sync) {
// need to add an empty string else it is nto added as query param.
target = target.queryParam("sync", "").queryParam("sync_timeout", syncTimeout);
}
if (responseType != ResponseType.None) {
// need to add an empty string else it is nto added as query param.
target = target.queryParam(responseType.value, "");
}
LOG.info("target uri [{}]", target.getUri());
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class ItemStoreResourceTest method configureClient.
@Override
protected void configureClient(ClientConfig config) {
// using AHC as a test client connector to avoid issues with HttpUrlConnection socket management.
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
// adjusting max. connections just to be safe - the testEventSourceReconnect is quite greedy...
cm.setMaxTotal(MAX_LISTENERS * MAX_ITEMS);
cm.setDefaultMaxPerRoute(MAX_LISTENERS * MAX_ITEMS);
config.register(SseFeature.class).property(ApacheClientProperties.CONNECTION_MANAGER, cm).property(ClientProperties.READ_TIMEOUT, 2000).connectorProvider(new ApacheConnectorProvider());
}
Aggregations