mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-07 02:29:17 +00:00
[HTTPCLIENT-1786] Port from Apache Commons Logging to Apache Log4j 2.
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1767391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f44544ec3c
commit
fd412e7bf1
@ -13,6 +13,8 @@ Changelog:
|
||||
* [HTTPCLIENT-1717] Make fluent API .Content.Content(byte[], ContentType) public.
|
||||
Contributed by Cash Costello <cash.costello at gmail.com>
|
||||
|
||||
* [HTTPCLIENT-1786] Port from Apache Commons Logging to Apache Log4j 2.
|
||||
Contributed by Gary Gregory <ggregory at apache.org>
|
||||
|
||||
Release 5.0-ALPHA1
|
||||
-------------------
|
||||
|
@ -45,10 +45,17 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
|
29
httpclient5-cache/src/test/resources/log4j2.xml
Normal file
29
httpclient5-cache/src/test/resources/log4j2.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<Configuration status="WARN" name="XMLConfigTest">
|
||||
<Appenders>
|
||||
<Console name="STDOUT">
|
||||
<PatternLayout pattern="%d %-5level [%t][%logger]%notEmpty{[%markerSimpleName]} %msg%n%xThrowable" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -53,8 +53,15 @@
|
||||
</dependency>
|
||||
<!-- direct dependency on logging -->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@ -87,6 +94,7 @@
|
||||
<excludes>
|
||||
<exclude>.externalToolBuilders/**</exclude>
|
||||
<exclude>maven-eclipse.xml</exclude>
|
||||
<exclude>.checkstyle</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
29
httpclient5-fluent/src/test/resources/log4j2.xml
Normal file
29
httpclient5-fluent/src/test/resources/log4j2.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<Configuration status="WARN" name="XMLConfigTest">
|
||||
<Appenders>
|
||||
<Console name="STDOUT">
|
||||
<PatternLayout pattern="%d %-5level [%t][%logger]%notEmpty{[%markerSimpleName]} %msg%n%xThrowable" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -41,7 +41,7 @@
|
||||
|
||||
<properties>
|
||||
<httpcore.osgi.import.version>"5.0-alpha1"</httpcore.osgi.import.version>
|
||||
<commons-logging.osgi.import.version>"[1.1.0, 1.3.0)"</commons-logging.osgi.import.version>
|
||||
<log4j.osgi.import.version>"2.7"</log4j.osgi.import.version>
|
||||
<pax.url.version>2.4.1</pax.url.version>
|
||||
<pax.exam.version>4.5.0</pax.exam.version>
|
||||
<osgi.framework.version>5.0.0</osgi.framework.version>
|
||||
@ -197,7 +197,7 @@
|
||||
org.ietf.jgss,,
|
||||
org.osgi.framework,
|
||||
org.osgi.service.cm,
|
||||
org.apache.commons.logging;version=${commons-logging.osgi.import.version},
|
||||
org.apache.logging.log4j;version=${log4j.osgi.import.version},
|
||||
org.apache.hc.core5.concurrent;version=${httpcore.osgi.import.version},
|
||||
org.apache.hc.core5.pool;version=${httpcore.osgi.import.version},
|
||||
org.apache.hc.core5.ssl;version=${httpcore.osgi.import.version},
|
||||
|
@ -26,6 +26,8 @@
|
||||
*/
|
||||
package org.apache.hc.client5.http.osgi.impl;
|
||||
|
||||
import static org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.getSocketFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
|
||||
@ -37,8 +39,6 @@
|
||||
import org.apache.hc.core5.http.config.Registry;
|
||||
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||
|
||||
import static org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.getSocketFactory;
|
||||
|
||||
final class HttpClientBuilderConfigurator {
|
||||
|
||||
private final OSGiCredentialsProvider credentialsProvider;
|
||||
|
@ -28,8 +28,6 @@
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.auth.AuthScope;
|
||||
import org.apache.hc.client5.http.auth.Credentials;
|
||||
import org.apache.hc.client5.http.auth.CredentialsStore;
|
||||
@ -37,13 +35,15 @@
|
||||
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.hc.client5.http.osgi.services.ProxyConfiguration;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @since 4.3
|
||||
*/
|
||||
final class OSGiCredentialsProvider implements CredentialsStore {
|
||||
|
||||
private static final Log log = LogFactory.getLog(OSGiCredentialsProvider.class);
|
||||
private static final Logger log = LogManager.getLogger(OSGiCredentialsProvider.class);
|
||||
|
||||
private static final int HOST_AND_PORT_MATCH = 12;
|
||||
|
||||
|
@ -27,9 +27,9 @@
|
||||
package org.apache.hc.client5.http.osgi.impl;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import org.apache.hc.client5.http.osgi.impl.HostMatcher.DomainNameMatcher;
|
||||
import org.apache.hc.client5.http.osgi.impl.HostMatcher.HostMatcherFactory;
|
||||
|
@ -38,8 +38,8 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.hc.client5.http.entity.mime.ByteArrayBody;
|
||||
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.hc.client5.http.entity.mime.StringBody;
|
||||
import org.apache.hc.client5.http.methods.HttpPost;
|
||||
import org.apache.hc.core5.http.HttpEntity;
|
||||
|
@ -26,6 +26,13 @@
|
||||
*/
|
||||
package org.apache.hc.client5.http.osgi.impl;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.apache.hc.client5.http.auth.AuthScope;
|
||||
import org.apache.hc.client5.http.auth.Credentials;
|
||||
import org.apache.hc.client5.http.auth.CredentialsProvider;
|
||||
@ -36,13 +43,6 @@
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class OSGiCredentialsProviderTest {
|
||||
|
||||
private static final String HOST = "proxy.example.org";
|
||||
|
@ -26,14 +26,14 @@
|
||||
*/
|
||||
package org.apache.hc.client5.http.osgi.impl;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
||||
public class WeakListTest {
|
||||
|
||||
|
29
httpclient5-osgi/src/test/resources/log4j2.xml
Normal file
29
httpclient5-osgi/src/test/resources/log4j2.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<Configuration status="WARN" name="XMLConfigTest">
|
||||
<Appenders>
|
||||
<Console name="STDOUT">
|
||||
<PatternLayout pattern="%d %-5level [%t][%logger]%notEmpty{[%markerSimpleName]} %msg%n%xThrowable" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -66,6 +66,11 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<reporting>
|
||||
|
@ -29,8 +29,6 @@
|
||||
import java.security.Principal;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.RouteInfo;
|
||||
import org.apache.hc.client5.http.auth.AuthChallenge;
|
||||
import org.apache.hc.client5.http.auth.AuthScheme;
|
||||
@ -45,6 +43,8 @@
|
||||
import org.apache.hc.core5.http.HttpRequest;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.sun.jna.platform.win32.Secur32;
|
||||
import com.sun.jna.platform.win32.Secur32Util;
|
||||
@ -71,7 +71,7 @@
|
||||
@NotThreadSafe
|
||||
public class WindowsNegotiateScheme implements AuthScheme {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
// NTLM or Negotiate
|
||||
private final String scheme;
|
||||
|
29
httpclient5-win/src/test/resources/log4j2.xml
Normal file
29
httpclient5-win/src/test/resources/log4j2.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<Configuration status="WARN" name="XMLConfigTest">
|
||||
<Appenders>
|
||||
<Console name="STDOUT">
|
||||
<PatternLayout pattern="%d %-5level [%t][%logger]%notEmpty{[%markerSimpleName]} %msg%n%xThrowable" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -43,10 +43,17 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
|
@ -28,8 +28,8 @@
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.hc.client5.http.entity.mime.FileBody;
|
||||
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.hc.client5.http.entity.mime.StringBody;
|
||||
import org.apache.hc.client5.http.impl.sync.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.sync.HttpClients;
|
||||
|
@ -26,6 +26,8 @@
|
||||
*/
|
||||
package org.apache.hc.client5.http.auth;
|
||||
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
|
||||
/**
|
||||
* Abstract store of authentication credentials.
|
||||
* <p>
|
||||
|
@ -32,10 +32,10 @@
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.DnsResolver;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* In-memory {@link DnsResolver} implementation.
|
||||
@ -45,7 +45,7 @@
|
||||
public class InMemoryDnsResolver implements DnsResolver {
|
||||
|
||||
/** Logger associated to this class. */
|
||||
private final Log log = LogFactory.getLog(InMemoryDnsResolver.class);
|
||||
private final Logger log = LogManager.getLogger(InMemoryDnsResolver.class);
|
||||
|
||||
/**
|
||||
* In-memory collection that will hold the associations between a host name
|
||||
|
@ -35,8 +35,6 @@
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.SchemePortResolver;
|
||||
import org.apache.hc.client5.http.UnsupportedSchemeException;
|
||||
import org.apache.hc.client5.http.auth.AuthCache;
|
||||
@ -45,6 +43,8 @@
|
||||
import org.apache.hc.core5.annotation.ThreadSafe;
|
||||
import org.apache.hc.core5.http.HttpHost;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link AuthCache}. This implements
|
||||
@ -59,7 +59,7 @@
|
||||
@ThreadSafe
|
||||
public class BasicAuthCache implements AuthCache {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final Map<HttpHost, byte[]> map;
|
||||
private final SchemePortResolver schemePortResolver;
|
||||
|
@ -31,8 +31,6 @@
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.DnsResolver;
|
||||
import org.apache.hc.client5.http.SystemDefaultDnsResolver;
|
||||
import org.apache.hc.client5.http.auth.AuthChallenge;
|
||||
@ -49,6 +47,8 @@
|
||||
import org.apache.hc.core5.http.HttpRequest;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.ietf.jgss.GSSContext;
|
||||
import org.ietf.jgss.GSSCredential;
|
||||
import org.ietf.jgss.GSSException;
|
||||
@ -69,7 +69,7 @@ enum State {
|
||||
FAILED,
|
||||
}
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final DnsResolver dnsResolver;
|
||||
private final boolean stripPort;
|
||||
|
@ -34,8 +34,6 @@
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.auth.AuthCache;
|
||||
import org.apache.hc.client5.http.auth.AuthChallenge;
|
||||
import org.apache.hc.client5.http.auth.AuthExchange;
|
||||
@ -60,18 +58,20 @@
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Asserts;
|
||||
import org.apache.hc.core5.util.CharArrayBuffer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @since 4.3
|
||||
*/
|
||||
public class HttpAuthenticator {
|
||||
|
||||
private final Log log;
|
||||
private final Logger log;
|
||||
private final AuthChallengeParser parser;
|
||||
|
||||
public HttpAuthenticator(final Log log) {
|
||||
public HttpAuthenticator(final Logger log) {
|
||||
super();
|
||||
this.log = log != null ? log : LogFactory.getLog(getClass());
|
||||
this.log = log != null ? log : LogManager.getLogger(getClass());
|
||||
this.parser = new AuthChallengeParser();
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,6 @@
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.DnsResolver;
|
||||
import org.apache.hc.client5.http.HttpConnectionFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
@ -60,6 +58,8 @@
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.Asserts;
|
||||
import org.apache.hc.core5.util.LangUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* A connection manager for a single connection. This connection manager maintains only one active
|
||||
@ -82,7 +82,7 @@
|
||||
@ThreadSafe
|
||||
public class BasicHttpClientConnectionManager implements HttpClientConnectionManager, Closeable {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final HttpClientConnectionOperator connectionOperator;
|
||||
private final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory;
|
||||
|
@ -29,14 +29,14 @@
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.io.ManagedHttpClientConnection;
|
||||
import org.apache.hc.core5.annotation.ThreadSafe;
|
||||
import org.apache.hc.core5.pool.PoolEntryCallback;
|
||||
import org.apache.hc.core5.pool.io.AbstractConnPool;
|
||||
import org.apache.hc.core5.pool.io.ConnFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @since 4.3
|
||||
@ -46,7 +46,7 @@ class CPool extends AbstractConnPool<HttpRoute, ManagedHttpClientConnection, CPo
|
||||
|
||||
private static final AtomicLong COUNTER = new AtomicLong();
|
||||
|
||||
private final Log log = LogFactory.getLog(CPool.class);
|
||||
private final Logger log = LogManager.getLogger(CPool.class);
|
||||
private final long timeToLive;
|
||||
private final TimeUnit tunit;
|
||||
|
||||
|
@ -30,12 +30,12 @@
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.io.ManagedHttpClientConnection;
|
||||
import org.apache.hc.core5.annotation.ThreadSafe;
|
||||
import org.apache.hc.core5.http.io.HttpClientConnection;
|
||||
import org.apache.hc.core5.pool.PoolEntry;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @since 4.3
|
||||
@ -43,11 +43,11 @@
|
||||
@ThreadSafe
|
||||
class CPoolEntry extends PoolEntry<HttpRoute, ManagedHttpClientConnection> {
|
||||
|
||||
private final Log log;
|
||||
private final Logger log;
|
||||
private volatile boolean routeComplete;
|
||||
|
||||
public CPoolEntry(
|
||||
final Log log,
|
||||
final Logger log,
|
||||
final String id,
|
||||
final HttpRoute route,
|
||||
final ManagedHttpClientConnection conn,
|
||||
|
@ -34,8 +34,6 @@
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.ConnectTimeoutException;
|
||||
import org.apache.hc.client5.http.DnsResolver;
|
||||
import org.apache.hc.client5.http.HttpHostConnectException;
|
||||
@ -54,6 +52,8 @@
|
||||
import org.apache.hc.core5.http.config.SocketConfig;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link HttpClientConnectionOperator} used as default in Http client,
|
||||
@ -67,7 +67,7 @@ public class DefaultHttpClientConnectionOperator implements HttpClientConnection
|
||||
|
||||
static final String SOCKET_FACTORY_REGISTRY = "http.socket-factory-registry";
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final Lookup<ConnectionSocketFactory> socketFactoryRegistry;
|
||||
private final SchemePortResolver schemePortResolver;
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.core5.annotation.NotThreadSafe;
|
||||
import org.apache.hc.core5.http.HttpException;
|
||||
import org.apache.hc.core5.http.HttpResponse;
|
||||
@ -39,6 +37,8 @@
|
||||
import org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser;
|
||||
import org.apache.hc.core5.http.message.LineParser;
|
||||
import org.apache.hc.core5.util.CharArrayBuffer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Lenient HTTP response parser implementation that can skip malformed data until
|
||||
@ -49,7 +49,7 @@
|
||||
@NotThreadSafe
|
||||
public class LenientHttpResponseParser extends DefaultHttpResponseParser {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* Creates new instance of DefaultHttpResponseParser.
|
||||
|
@ -34,7 +34,6 @@
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hc.core5.annotation.NotThreadSafe;
|
||||
import org.apache.hc.core5.http.ContentLengthStrategy;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
@ -43,19 +42,20 @@
|
||||
import org.apache.hc.core5.http.config.MessageConstraints;
|
||||
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
|
||||
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@NotThreadSafe
|
||||
class LoggingManagedHttpClientConnection extends DefaultManagedHttpClientConnection {
|
||||
|
||||
private final Log log;
|
||||
private final Log headerlog;
|
||||
private final Logger log;
|
||||
private final Logger headerlog;
|
||||
private final Wire wire;
|
||||
|
||||
public LoggingManagedHttpClientConnection(
|
||||
final String id,
|
||||
final Log log,
|
||||
final Log headerlog,
|
||||
final Log wirelog,
|
||||
final Logger log,
|
||||
final Logger headerlog,
|
||||
final Logger wirelog,
|
||||
final int buffersize,
|
||||
final int fragmentSizeHint,
|
||||
final CharsetDecoder chardecoder,
|
||||
|
@ -33,8 +33,6 @@
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpConnectionFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.io.ManagedHttpClientConnection;
|
||||
@ -47,6 +45,8 @@
|
||||
import org.apache.hc.core5.http.impl.io.DefaultHttpRequestWriterFactory;
|
||||
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
|
||||
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Factory for {@link ManagedHttpClientConnection} instances.
|
||||
@ -60,9 +60,9 @@ public class ManagedHttpClientConnectionFactory
|
||||
|
||||
public static final ManagedHttpClientConnectionFactory INSTANCE = new ManagedHttpClientConnectionFactory();
|
||||
|
||||
private final Log log = LogFactory.getLog(DefaultManagedHttpClientConnection.class);
|
||||
private final Log headerlog = LogFactory.getLog("org.apache.http.headers");
|
||||
private final Log wirelog = LogFactory.getLog("org.apache.http.wire");
|
||||
private final Logger log = LogManager.getLogger(DefaultManagedHttpClientConnection.class);
|
||||
private final Logger headerlog = LogManager.getLogger("org.apache.http.headers");
|
||||
private final Logger wirelog = LogManager.getLogger("org.apache.http.wire");
|
||||
|
||||
private final HttpMessageWriterFactory<HttpRequest> requestWriterFactory;
|
||||
private final HttpMessageParserFactory<HttpResponse> responseParserFactory;
|
||||
|
@ -38,8 +38,6 @@
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.ConnectionPoolTimeoutException;
|
||||
import org.apache.hc.client5.http.DnsResolver;
|
||||
import org.apache.hc.client5.http.HttpConnectionFactory;
|
||||
@ -67,6 +65,8 @@
|
||||
import org.apache.hc.core5.pool.io.ConnFactory;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.Asserts;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* {@code ClientConnectionPoolManager} maintains a pool of
|
||||
@ -104,7 +104,7 @@
|
||||
public class PoolingHttpClientConnectionManager
|
||||
implements HttpClientConnectionManager, ConnPoolControl<HttpRoute>, Closeable {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 25;
|
||||
public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE = 5;
|
||||
|
@ -30,9 +30,9 @@
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hc.core5.annotation.Immutable;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Logs data to the wire LOG.
|
||||
@ -42,18 +42,18 @@
|
||||
@Immutable
|
||||
class Wire {
|
||||
|
||||
private final Log log;
|
||||
private final Logger log;
|
||||
private final String id;
|
||||
|
||||
/**
|
||||
* @since 4.3
|
||||
*/
|
||||
public Wire(final Log log, final String id) {
|
||||
public Wire(final Logger log, final String id) {
|
||||
this.log = log;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Wire(final Log log) {
|
||||
public Wire(final Logger log) {
|
||||
this(log, "");
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.auth.AuthChallenge;
|
||||
import org.apache.hc.client5.http.auth.AuthScheme;
|
||||
import org.apache.hc.client5.http.auth.AuthSchemeProvider;
|
||||
@ -49,6 +47,8 @@
|
||||
import org.apache.hc.core5.http.config.Lookup;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link AuthenticationStrategy}
|
||||
@ -58,7 +58,7 @@
|
||||
@Immutable
|
||||
public class DefaultAuthenticationStrategy implements AuthenticationStrategy {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
public static final DefaultAuthenticationStrategy INSTANCE = new DefaultAuthenticationStrategy();
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.config.RequestConfig;
|
||||
import org.apache.hc.client5.http.methods.HttpGet;
|
||||
import org.apache.hc.client5.http.methods.HttpUriRequest;
|
||||
@ -58,6 +56,8 @@
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.Asserts;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link RedirectStrategy}. This strategy honors the restrictions
|
||||
@ -71,7 +71,7 @@
|
||||
@Immutable
|
||||
public class DefaultRedirectStrategy implements RedirectStrategy {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
public static final DefaultRedirectStrategy INSTANCE = new DefaultRedirectStrategy();
|
||||
|
||||
|
@ -31,8 +31,6 @@
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.methods.CloseableHttpResponse;
|
||||
import org.apache.hc.client5.http.methods.HttpUriRequest;
|
||||
import org.apache.hc.client5.http.protocol.ClientProtocolException;
|
||||
@ -46,6 +44,8 @@
|
||||
import org.apache.hc.core5.http.entity.EntityUtils;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Base implementation of {@link HttpClient} that also implements {@link Closeable}.
|
||||
@ -55,7 +55,7 @@
|
||||
@ThreadSafe
|
||||
public abstract class CloseableHttpClient implements HttpClient, Closeable {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
protected abstract CloseableHttpResponse doExecute(HttpHost target, HttpRequest request,
|
||||
HttpContext context) throws IOException;
|
||||
|
@ -32,12 +32,12 @@
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hc.client5.http.io.ConnectionReleaseTrigger;
|
||||
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
|
||||
import org.apache.hc.core5.annotation.ThreadSafe;
|
||||
import org.apache.hc.core5.concurrent.Cancellable;
|
||||
import org.apache.hc.core5.http.io.HttpClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Internal connection holder.
|
||||
@ -47,7 +47,7 @@
|
||||
@ThreadSafe
|
||||
class ConnectionHolder implements ConnectionReleaseTrigger, Cancellable, Closeable {
|
||||
|
||||
private final Log log;
|
||||
private final Logger log;
|
||||
|
||||
private final HttpClientConnectionManager manager;
|
||||
private final HttpClientConnection managedConn;
|
||||
@ -58,7 +58,7 @@ class ConnectionHolder implements ConnectionReleaseTrigger, Cancellable, Closeab
|
||||
private volatile TimeUnit tunit;
|
||||
|
||||
public ConnectionHolder(
|
||||
final Log log,
|
||||
final Logger log,
|
||||
final HttpClientConnectionManager manager,
|
||||
final HttpClientConnection managedConn) {
|
||||
super();
|
||||
|
@ -31,8 +31,6 @@
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.auth.AuthSchemeProvider;
|
||||
import org.apache.hc.client5.http.auth.CredentialsProvider;
|
||||
@ -55,6 +53,8 @@
|
||||
import org.apache.hc.core5.http.protocol.BasicHttpContext;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Internal class.
|
||||
@ -64,7 +64,7 @@
|
||||
@ThreadSafe
|
||||
class InternalHttpClient extends CloseableHttpClient implements Configurable {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final ClientExecChain execChain;
|
||||
private final HttpClientConnectionManager connManager;
|
||||
|
@ -32,8 +32,6 @@
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.ConnectionKeepAliveStrategy;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.RouteTracker;
|
||||
@ -71,6 +69,8 @@
|
||||
import org.apache.hc.core5.http.protocol.ImmutableHttpProcessor;
|
||||
import org.apache.hc.core5.http.protocol.RequestTargetHost;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* The last request executor in the HTTP request execution chain
|
||||
@ -85,7 +85,7 @@
|
||||
@Immutable
|
||||
public class MainClientExec implements ClientExecChain {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final HttpRequestExecutor requestExecutor;
|
||||
private final HttpClientConnectionManager connManager;
|
||||
|
@ -34,8 +34,6 @@
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.ConnectionKeepAliveStrategy;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.config.RequestConfig;
|
||||
@ -67,6 +65,8 @@
|
||||
import org.apache.hc.core5.http.protocol.RequestUserAgent;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.VersionInfo;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request executor that implements the most fundamental aspects of
|
||||
@ -80,7 +80,7 @@
|
||||
@Immutable
|
||||
public class MinimalClientExec implements ClientExecChain {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final HttpRequestExecutor requestExecutor;
|
||||
private final HttpClientConnectionManager connManager;
|
||||
|
@ -31,8 +31,6 @@
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.auth.AuthScope;
|
||||
import org.apache.hc.client5.http.auth.CredentialsProvider;
|
||||
@ -52,6 +50,8 @@
|
||||
import org.apache.hc.core5.http.protocol.HttpCoreContext;
|
||||
import org.apache.hc.core5.http.protocol.HttpProcessor;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request executor in the request execution chain that is responsible
|
||||
@ -70,7 +70,7 @@
|
||||
@Immutable
|
||||
public class ProtocolExec implements ClientExecChain {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final ClientExecChain requestExecutor;
|
||||
private final HttpProcessor httpProcessor;
|
||||
|
@ -31,8 +31,6 @@
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.auth.AuthExchange;
|
||||
import org.apache.hc.client5.http.auth.AuthScheme;
|
||||
@ -52,6 +50,8 @@
|
||||
import org.apache.hc.core5.http.ProtocolException;
|
||||
import org.apache.hc.core5.http.entity.EntityUtils;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request executor in the request execution chain that is responsible
|
||||
@ -67,7 +67,7 @@
|
||||
@ThreadSafe
|
||||
public class RedirectExec implements ClientExecChain {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final ClientExecChain requestExecutor;
|
||||
private final RedirectStrategy redirectStrategy;
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.methods.CloseableHttpResponse;
|
||||
import org.apache.hc.client5.http.methods.HttpExecutionAware;
|
||||
@ -43,6 +41,8 @@
|
||||
import org.apache.hc.core5.http.HttpException;
|
||||
import org.apache.hc.core5.http.NoHttpResponseException;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request executor in the request execution chain that is responsible
|
||||
@ -59,7 +59,7 @@
|
||||
@Immutable
|
||||
public class RetryExec implements ClientExecChain {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final ClientExecChain requestExecutor;
|
||||
private final HttpRequestRetryHandler retryHandler;
|
||||
|
@ -30,8 +30,6 @@
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
import org.apache.hc.client5.http.methods.CloseableHttpResponse;
|
||||
import org.apache.hc.client5.http.methods.HttpExecutionAware;
|
||||
@ -42,6 +40,8 @@
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.HttpException;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request executor in the request execution chain that is responsible
|
||||
@ -58,7 +58,7 @@
|
||||
@Immutable
|
||||
public class ServiceUnavailableRetryExec implements ClientExecChain {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final ClientExecChain requestExecutor;
|
||||
private final ServiceUnavailableRetryStrategy retryStrategy;
|
||||
|
@ -34,8 +34,6 @@
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.RouteInfo;
|
||||
import org.apache.hc.client5.http.config.CookieSpecs;
|
||||
import org.apache.hc.client5.http.config.RequestConfig;
|
||||
@ -55,6 +53,8 @@
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request interceptor that matches cookies available in the current
|
||||
@ -66,7 +66,7 @@
|
||||
@Immutable
|
||||
public class RequestAddCookies implements HttpRequestInterceptor {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
public RequestAddCookies() {
|
||||
super();
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.RouteInfo;
|
||||
import org.apache.hc.client5.http.auth.AuthCache;
|
||||
import org.apache.hc.client5.http.auth.AuthExchange;
|
||||
@ -43,6 +41,8 @@
|
||||
import org.apache.hc.core5.http.HttpRequestInterceptor;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Request interceptor that can preemptively authenticate against known hosts,
|
||||
@ -54,7 +54,7 @@
|
||||
@Immutable
|
||||
public class RequestAuthCache implements HttpRequestInterceptor {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
public RequestAuthCache() {
|
||||
super();
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.RouteInfo;
|
||||
import org.apache.hc.core5.annotation.Immutable;
|
||||
import org.apache.hc.core5.http.HeaderElements;
|
||||
@ -40,6 +38,8 @@
|
||||
import org.apache.hc.core5.http.HttpRequestInterceptor;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* This protocol interceptor is responsible for adding {@code Connection}
|
||||
@ -51,7 +51,7 @@
|
||||
@Immutable
|
||||
public class RequestClientConnControl implements HttpRequestInterceptor {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private static final String PROXY_CONN_DIRECTIVE = "Proxy-Connection";
|
||||
|
||||
|
@ -31,8 +31,6 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.cookie.Cookie;
|
||||
import org.apache.hc.client5.http.cookie.CookieOrigin;
|
||||
import org.apache.hc.client5.http.cookie.CookieSpec;
|
||||
@ -45,6 +43,8 @@
|
||||
import org.apache.hc.core5.http.HttpResponseInterceptor;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Response interceptor that populates the current {@link CookieStore} with data
|
||||
@ -55,7 +55,7 @@
|
||||
@Immutable
|
||||
public class ResponseProcessCookies implements HttpResponseInterceptor {
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
public ResponseProcessCookies() {
|
||||
super();
|
||||
|
@ -36,10 +36,10 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.core5.annotation.ThreadSafe;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* {@link PublicSuffixMatcher} loader.
|
||||
@ -82,7 +82,7 @@ public static PublicSuffixMatcher getDefault() {
|
||||
DEFAULT_INSTANCE = load(url);
|
||||
} catch (final IOException ex) {
|
||||
// Should never happen
|
||||
final Log log = LogFactory.getLog(PublicSuffixMatcherLoader.class);
|
||||
final Logger log = LogManager.getLogger(PublicSuffixMatcherLoader.class);
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("Failure loading public suffix list from default resource", ex);
|
||||
}
|
||||
|
@ -49,12 +49,12 @@
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.psl.DomainType;
|
||||
import org.apache.hc.client5.http.psl.PublicSuffixMatcher;
|
||||
import org.apache.hc.client5.http.utils.InetAddressUtils;
|
||||
import org.apache.hc.core5.annotation.Immutable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Default {@link javax.net.ssl.HostnameVerifier} implementation.
|
||||
@ -69,7 +69,7 @@ enum TYPE { IPv4, IPv6, DNS }
|
||||
final static int DNS_NAME_TYPE = 2;
|
||||
final static int IP_ADDRESS_TYPE = 7;
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
private final PublicSuffixMatcher publicSuffixMatcher;
|
||||
|
||||
|
@ -47,8 +47,6 @@
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.psl.PublicSuffixMatcherLoader;
|
||||
import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
|
||||
import org.apache.hc.core5.annotation.ThreadSafe;
|
||||
@ -57,6 +55,8 @@
|
||||
import org.apache.hc.core5.ssl.SSLContexts;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Layered socket factory for TLS/SSL connections.
|
||||
@ -139,7 +139,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
||||
public static final String TLS = "TLS";
|
||||
public static final String SSL = "SSL";
|
||||
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* @since 4.4
|
||||
|
@ -34,7 +34,6 @@
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hc.client5.http.ConnectionPoolTimeoutException;
|
||||
import org.apache.hc.client5.http.DnsResolver;
|
||||
import org.apache.hc.client5.http.HttpRoute;
|
||||
@ -50,6 +49,7 @@
|
||||
import org.apache.hc.core5.http.config.SocketConfig;
|
||||
import org.apache.hc.core5.http.io.HttpClientConnection;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -95,7 +95,7 @@ public void testLeaseRelease() throws Exception {
|
||||
final HttpHost target = new HttpHost("localhost", 80);
|
||||
final HttpRoute route = new HttpRoute(target);
|
||||
|
||||
final CPoolEntry entry = new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS);
|
||||
entry.markRouteComplete();
|
||||
|
||||
@ -124,7 +124,7 @@ public void testReleaseRouteIncomplete() throws Exception {
|
||||
final HttpHost target = new HttpHost("localhost", 80);
|
||||
final HttpRoute route = new HttpRoute(target);
|
||||
|
||||
final CPoolEntry entry = new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS);
|
||||
|
||||
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
|
||||
@ -152,7 +152,7 @@ public void testLeaseFutureCancelled() throws Exception {
|
||||
final HttpHost target = new HttpHost("localhost", 80);
|
||||
final HttpRoute route = new HttpRoute(target);
|
||||
|
||||
final CPoolEntry entry = new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS);
|
||||
entry.markRouteComplete();
|
||||
|
||||
@ -182,7 +182,7 @@ public void testReleaseReusable() throws Exception {
|
||||
final HttpHost target = new HttpHost("localhost", 80);
|
||||
final HttpRoute route = new HttpRoute(target);
|
||||
|
||||
final CPoolEntry entry = Mockito.spy(new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = Mockito.spy(new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS));
|
||||
entry.markRouteComplete();
|
||||
|
||||
@ -208,7 +208,7 @@ public void testReleaseNonReusable() throws Exception {
|
||||
final HttpHost target = new HttpHost("localhost", 80);
|
||||
final HttpRoute route = new HttpRoute(target);
|
||||
|
||||
final CPoolEntry entry = Mockito.spy(new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = Mockito.spy(new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS));
|
||||
entry.markRouteComplete();
|
||||
|
||||
@ -236,7 +236,7 @@ public void testTargetConnect() throws Exception {
|
||||
final InetAddress local = InetAddress.getByAddress(new byte[]{127, 0, 0, 1});
|
||||
final HttpRoute route = new HttpRoute(target, local, true);
|
||||
|
||||
final CPoolEntry entry = new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS);
|
||||
entry.markRouteComplete();
|
||||
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
|
||||
@ -286,7 +286,7 @@ public void testProxyConnectAndUpgrade() throws Exception {
|
||||
final InetAddress local = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
|
||||
final HttpRoute route = new HttpRoute(target, local, proxy, true);
|
||||
|
||||
final CPoolEntry entry = new CPoolEntry(LogFactory.getLog(getClass()), "id", route, conn,
|
||||
final CPoolEntry entry = new CPoolEntry(LogManager.getLogger(getClass()), "id", route, conn,
|
||||
-1, TimeUnit.MILLISECONDS);
|
||||
entry.markRouteComplete();
|
||||
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
|
||||
|
@ -29,9 +29,9 @@
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
|
||||
import org.apache.hc.core5.http.io.HttpClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -40,14 +40,14 @@
|
||||
@SuppressWarnings({"static-access"}) // test code
|
||||
public class TestConnectionHolder {
|
||||
|
||||
private Log log;
|
||||
private Logger log;
|
||||
private HttpClientConnectionManager mgr;
|
||||
private HttpClientConnection conn;
|
||||
private ConnectionHolder connHolder;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
log = Mockito.mock(Log.class);
|
||||
log = Mockito.mock(Logger.class);
|
||||
mgr = Mockito.mock(HttpClientConnectionManager.class);
|
||||
conn = Mockito.mock(HttpClientConnection.class);
|
||||
connHolder = new ConnectionHolder(log, mgr, conn);
|
||||
|
29
httpclient5/src/test/resources/log4j2.xml
Normal file
29
httpclient5/src/test/resources/log4j2.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<Configuration status="WARN" name="XMLConfigTest">
|
||||
<Appenders>
|
||||
<Console name="STDOUT">
|
||||
<PatternLayout pattern="%d %-5level [%t][%logger]%notEmpty{[%markerSimpleName]} %msg%n%xThrowable" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
14
pom.xml
14
pom.xml
@ -68,7 +68,7 @@
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<httpcore.version>5.0-alpha1</httpcore.version>
|
||||
<commons-logging.version>1.2</commons-logging.version>
|
||||
<log4j.version>2.7</log4j.version>
|
||||
<commons-codec.version>1.10</commons-codec.version>
|
||||
<ehcache.version>2.6.11</ehcache.version>
|
||||
<memcached.version>2.12.0</memcached.version>
|
||||
@ -89,9 +89,15 @@
|
||||
<version>${httpcore.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>${commons-logging.version}</version>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
|
Loading…
x
Reference in New Issue
Block a user