List of usage examples for org.apache.http.config ConnectionConfig getBufferSize
public int getBufferSize()
From source file:com.liferay.sync.engine.session.SyncManagedHttpClientConnectionFactory.java
@Override public ManagedHttpClientConnection create(HttpRoute httpRoute, ConnectionConfig connectionConfig) { if (connectionConfig == null) { connectionConfig = ConnectionConfig.DEFAULT; }/*from www . ja v a 2 s .c om*/ CharsetDecoder charsetDecoder = null; CharsetEncoder charsetEncoder = null; Charset charset = connectionConfig.getCharset(); if (charset != null) { charsetDecoder = charset.newDecoder(); charsetEncoder = charset.newEncoder(); CodingErrorAction malformedInputAction = connectionConfig.getMalformedInputAction(); if (malformedInputAction == null) { malformedInputAction = CodingErrorAction.REPORT; } charsetDecoder.onMalformedInput(malformedInputAction); charsetEncoder.onMalformedInput(malformedInputAction); CodingErrorAction unmappableInputAction = connectionConfig.getUnmappableInputAction(); if (unmappableInputAction == null) { unmappableInputAction = CodingErrorAction.REPORT; } charsetDecoder.onUnmappableCharacter(unmappableInputAction); charsetEncoder.onUnmappableCharacter(unmappableInputAction); } return new SyncManagedHttpClientConnection("http-outgoing-" + _counter.getAndIncrement(), connectionConfig.getBufferSize(), connectionConfig.getFragmentSizeHint(), charsetDecoder, charsetEncoder, connectionConfig.getMessageConstraints(), null, null, null, DefaultHttpResponseParserFactory.INSTANCE); }
From source file:org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.java
public ManagedHttpClientConnection create(final HttpRoute route, final ConnectionConfig config) { final ConnectionConfig cconfig = config != null ? config : ConnectionConfig.DEFAULT; CharsetDecoder chardecoder = null; CharsetEncoder charencoder = null; final Charset charset = cconfig.getCharset(); final CodingErrorAction malformedInputAction = cconfig.getMalformedInputAction() != null ? cconfig.getMalformedInputAction() : CodingErrorAction.REPORT; final CodingErrorAction unmappableInputAction = cconfig.getUnmappableInputAction() != null ? cconfig.getUnmappableInputAction() : CodingErrorAction.REPORT; if (charset != null) { chardecoder = charset.newDecoder(); chardecoder.onMalformedInput(malformedInputAction); chardecoder.onUnmappableCharacter(unmappableInputAction); charencoder = charset.newEncoder(); charencoder.onMalformedInput(malformedInputAction); charencoder.onUnmappableCharacter(unmappableInputAction); }//from w ww . ja v a 2 s .co m final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement()); return new LoggingManagedHttpClientConnection(id, log, headerlog, wirelog, cconfig.getBufferSize(), cconfig.getFragmentSizeHint(), chardecoder, charencoder, cconfig.getMessageConstraints(), null, null, requestWriterFactory, responseParserFactory); }
From source file:org.apache.http.impl.nio.conn.DefaultClientAsyncConnectionFactory.java
@Override public ManagedNHttpClientConnection create(final IOSession iosession, final ConnectionConfig config) { final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement()); CharsetDecoder chardecoder = null; CharsetEncoder charencoder = null; final Charset charset = config.getCharset(); final CodingErrorAction malformedInputAction = config.getMalformedInputAction() != null ? config.getMalformedInputAction() : CodingErrorAction.REPORT; final CodingErrorAction unmappableInputAction = config.getUnmappableInputAction() != null ? config.getUnmappableInputAction() : CodingErrorAction.REPORT; if (charset != null) { chardecoder = charset.newDecoder(); chardecoder.onMalformedInput(malformedInputAction); chardecoder.onUnmappableCharacter(unmappableInputAction); charencoder = charset.newEncoder(); charencoder.onMalformedInput(malformedInputAction); charencoder.onUnmappableCharacter(unmappableInputAction); }/*from w w w . java2 s . c o m*/ final ManagedNHttpClientConnection conn = new ManagedNHttpClientConnectionImpl(id, this.log, this.headerlog, this.wirelog, iosession, config.getBufferSize(), config.getFragmentSizeHint(), this.allocator, chardecoder, charencoder, config.getMessageConstraints(), null, null, null, this.responseParserFactory); iosession.setAttribute(IOEventDispatch.CONNECTION_KEY, conn); return conn; }
From source file:org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.java
@Override public ManagedNHttpClientConnection create(final IOSession iosession, final ConnectionConfig config) { final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement()); CharsetDecoder chardecoder = null; CharsetEncoder charencoder = null; final Charset charset = config.getCharset(); final CodingErrorAction malformedInputAction = config.getMalformedInputAction() != null ? config.getMalformedInputAction() : CodingErrorAction.REPORT; final CodingErrorAction unmappableInputAction = config.getUnmappableInputAction() != null ? config.getUnmappableInputAction() : CodingErrorAction.REPORT; if (charset != null) { chardecoder = charset.newDecoder(); chardecoder.onMalformedInput(malformedInputAction); chardecoder.onUnmappableCharacter(unmappableInputAction); charencoder = charset.newEncoder(); charencoder.onMalformedInput(malformedInputAction); charencoder.onUnmappableCharacter(unmappableInputAction); }/*from w ww . ja v a 2s . c om*/ final ManagedNHttpClientConnection conn = new ManagedNHttpClientConnectionImpl(id, this.log, this.headerlog, this.wirelog, iosession, config.getBufferSize(), config.getFragmentSizeHint(), this.allocator, chardecoder, charencoder, config.getMessageConstraints(), null, null, this.requestWriterFactory, this.responseParserFactory); iosession.setAttribute(IOEventDispatch.CONNECTION_KEY, conn); return conn; }