ManagedHttpClientConnectionFactory.java (httpcomponents-client-4.5.6-src) | : | ManagedHttpClientConnectionFactory.java (httpcomponents-client-4.5.7-src) | ||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
*/ | */ | |||
@Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL) | @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL) | |||
public class ManagedHttpClientConnectionFactory | public class ManagedHttpClientConnectionFactory | |||
implements HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> { | implements HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> { | |||
private static final AtomicLong COUNTER = new AtomicLong(); | private static final AtomicLong COUNTER = new AtomicLong(); | |||
public static final ManagedHttpClientConnectionFactory INSTANCE = new Manage dHttpClientConnectionFactory(); | public static final ManagedHttpClientConnectionFactory INSTANCE = new Manage dHttpClientConnectionFactory(); | |||
private final Log log = LogFactory.getLog(DefaultManagedHttpClientConnection .class); | private final Log log = LogFactory.getLog(DefaultManagedHttpClientConnection .class); | |||
private final Log headerlog = LogFactory.getLog("org.apache.http.headers"); | private final Log headerLog = LogFactory.getLog("org.apache.http.headers"); | |||
private final Log wirelog = LogFactory.getLog("org.apache.http.wire"); | private final Log wireLog = LogFactory.getLog("org.apache.http.wire"); | |||
private final HttpMessageWriterFactory<HttpRequest> requestWriterFactory; | private final HttpMessageWriterFactory<HttpRequest> requestWriterFactory; | |||
private final HttpMessageParserFactory<HttpResponse> responseParserFactory; | private final HttpMessageParserFactory<HttpResponse> responseParserFactory; | |||
private final ContentLengthStrategy incomingContentStrategy; | private final ContentLengthStrategy incomingContentStrategy; | |||
private final ContentLengthStrategy outgoingContentStrategy; | private final ContentLengthStrategy outgoingContentStrategy; | |||
/** | /** | |||
* @since 4.4 | * @since 4.4 | |||
*/ | */ | |||
public ManagedHttpClientConnectionFactory( | public ManagedHttpClientConnectionFactory( | |||
skipping to change at line 111 | skipping to change at line 111 | |||
this(null, responseParserFactory); | this(null, responseParserFactory); | |||
} | } | |||
public ManagedHttpClientConnectionFactory() { | public ManagedHttpClientConnectionFactory() { | |||
this(null, null); | this(null, null); | |||
} | } | |||
@Override | @Override | |||
public ManagedHttpClientConnection create(final HttpRoute route, final Conne ctionConfig config) { | public ManagedHttpClientConnection create(final HttpRoute route, final Conne ctionConfig config) { | |||
final ConnectionConfig cconfig = config != null ? config : ConnectionCon fig.DEFAULT; | final ConnectionConfig cconfig = config != null ? config : ConnectionCon fig.DEFAULT; | |||
CharsetDecoder chardecoder = null; | CharsetDecoder charDecoder = null; | |||
CharsetEncoder charencoder = null; | CharsetEncoder charEncoder = null; | |||
final Charset charset = cconfig.getCharset(); | final Charset charset = cconfig.getCharset(); | |||
final CodingErrorAction malformedInputAction = cconfig.getMalformedInput Action() != null ? | final CodingErrorAction malformedInputAction = cconfig.getMalformedInput Action() != null ? | |||
cconfig.getMalformedInputAction() : CodingErrorAction.REPORT; | cconfig.getMalformedInputAction() : CodingErrorAction.REPORT; | |||
final CodingErrorAction unmappableInputAction = cconfig.getUnmappableInp utAction() != null ? | final CodingErrorAction unmappableInputAction = cconfig.getUnmappableInp utAction() != null ? | |||
cconfig.getUnmappableInputAction() : CodingErrorAction.REPORT; | cconfig.getUnmappableInputAction() : CodingErrorAction.REPORT; | |||
if (charset != null) { | if (charset != null) { | |||
chardecoder = charset.newDecoder(); | charDecoder = charset.newDecoder(); | |||
chardecoder.onMalformedInput(malformedInputAction); | charDecoder.onMalformedInput(malformedInputAction); | |||
chardecoder.onUnmappableCharacter(unmappableInputAction); | charDecoder.onUnmappableCharacter(unmappableInputAction); | |||
charencoder = charset.newEncoder(); | charEncoder = charset.newEncoder(); | |||
charencoder.onMalformedInput(malformedInputAction); | charEncoder.onMalformedInput(malformedInputAction); | |||
charencoder.onUnmappableCharacter(unmappableInputAction); | charEncoder.onUnmappableCharacter(unmappableInputAction); | |||
} | } | |||
final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncreme nt()); | final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncreme nt()); | |||
return new LoggingManagedHttpClientConnection( | return new LoggingManagedHttpClientConnection( | |||
id, | id, | |||
log, | log, | |||
headerlog, | headerLog, | |||
wirelog, | wireLog, | |||
cconfig.getBufferSize(), | cconfig.getBufferSize(), | |||
cconfig.getFragmentSizeHint(), | cconfig.getFragmentSizeHint(), | |||
chardecoder, | charDecoder, | |||
charencoder, | charEncoder, | |||
cconfig.getMessageConstraints(), | cconfig.getMessageConstraints(), | |||
incomingContentStrategy, | incomingContentStrategy, | |||
outgoingContentStrategy, | outgoingContentStrategy, | |||
requestWriterFactory, | requestWriterFactory, | |||
responseParserFactory); | responseParserFactory); | |||
} | } | |||
} | } | |||
End of changes. 5 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added |