Example usage for org.apache.http.impl.nio.conn ManagedNHttpClientConnectionImpl ManagedNHttpClientConnectionImpl

List of usage examples for org.apache.http.impl.nio.conn ManagedNHttpClientConnectionImpl ManagedNHttpClientConnectionImpl

Introduction

In this page you can find the example usage for org.apache.http.impl.nio.conn ManagedNHttpClientConnectionImpl ManagedNHttpClientConnectionImpl.

Prototype

public ManagedNHttpClientConnectionImpl(final String id, final Log log, final Log headerlog, final Log wirelog,
            final IOSession iosession, final int buffersize, final int fragmentSizeHint,
            final ByteBufferAllocator allocator, final CharsetDecoder chardecoder, final CharsetEncoder charencoder,
            final MessageConstraints constraints, final ContentLengthStrategy incomingContentStrategy,
            final ContentLengthStrategy outgoingContentStrategy,
            final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
            final NHttpMessageParserFactory<HttpResponse> responseParserFactory) 

Source Link

Usage

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);
    }//w  w w  .  j ava 2  s  .  com
    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);
    }/*w w  w  . ja  v  a  2  s.co 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, this.requestWriterFactory,
            this.responseParserFactory);
    iosession.setAttribute(IOEventDispatch.CONNECTION_KEY, conn);
    return conn;
}