Java 类org.apache.http.config.MessageConstraints 实例源码

项目:remote-files-sync    文件:BHttpConnectionBase.java   
/**
 * Creates new instance of BHttpConnectionBase.
 *
 * @param buffersize buffer size. Must be a positive number.
 * @param fragmentSizeHint fragment size hint.
 * @param chardecoder decoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 * @param charencoder encoder to be used for encoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for char to byte conversion.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param incomingContentStrategy incoming content length strategy. If <code>null</code>
 *   {@link LaxContentLengthStrategyHC4#INSTANCE} will be used.
 * @param outgoingContentStrategy outgoing content length strategy. If <code>null</code>
 *   {@link StrictContentLengthStrategyHC4#INSTANCE} will be used.
 */
protected BHttpConnectionBase(
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy) {
    super();
    Args.positive(buffersize, "Buffer size");
    final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
    final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
    this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
            constraints != null ? constraints : MessageConstraints.DEFAULT, chardecoder);
    this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize, fragmentSizeHint,
            charencoder);
    this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
    this.incomingContentStrategy = incomingContentStrategy != null ? incomingContentStrategy :
        LaxContentLengthStrategyHC4.INSTANCE;
    this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
        StrictContentLengthStrategyHC4.INSTANCE;
}
项目:remote-files-sync    文件:LoggingManagedHttpClientConnection.java   
public LoggingManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(id, buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.wire = new WireHC4(id);
}
项目:remote-files-sync    文件:DefaultManagedHttpClientConnection.java   
public DefaultManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.id = id;
    this.attributes = new ConcurrentHashMap<String, Object>();
}
项目:remote-files-sync    文件:SessionInputBufferImpl.java   
/**
 * Creates new instance of SessionInputBufferImpl.
 *
 * @param metrics HTTP transport metrics.
 * @param buffersize buffer size. Must be a positive number.
 * @param minChunkLimit size limit below which data chunks should be buffered in memory
 *   in order to minimize native method invocations on the underlying network socket.
 *   The optimal value of this parameter can be platform specific and defines a trade-off
 *   between performance of memory copy operations and that of native method invocation.
 *   If negative default chunk limited will be used.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param chardecoder chardecoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 */
public SessionInputBufferImpl(
        final HttpTransportMetricsImpl metrics,
        final int buffersize,
        final int minChunkLimit,
        final MessageConstraints constraints,
        final CharsetDecoder chardecoder) {
    Args.notNull(metrics, "HTTP transport metrcis");
    Args.positive(buffersize, "Buffer size");
    this.metrics = metrics;
    this.buffer = new byte[buffersize];
    this.bufferpos = 0;
    this.bufferlen = 0;
    this.minChunkLimit = minChunkLimit >= 0 ? minChunkLimit : 512;
    this.constraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.linebuffer = new ByteArrayBuffer(buffersize);
    this.decoder = chardecoder;
}
项目:purecloud-iot    文件:LoggingManagedHttpClientConnection.java   
public LoggingManagedHttpClientConnection(
        final String id,
        final Log log,
        final Log headerlog,
        final Log wirelog,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(id, buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.log = log;
    this.headerlog = headerlog;
    this.wire = new Wire(wirelog, id);
}
项目:purecloud-iot    文件:DefaultManagedHttpClientConnection.java   
public DefaultManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.id = id;
    this.attributes = new ConcurrentHashMap<String, Object>();
}
项目:Visit    文件:BHttpConnectionBase.java   
/**
 * Creates new instance of BHttpConnectionBase.
 *
 * @param buffersize buffer size. Must be a positive number.
 * @param fragmentSizeHint fragment size hint.
 * @param chardecoder decoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 * @param charencoder encoder to be used for encoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for char to byte conversion.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param incomingContentStrategy incoming content length strategy. If <code>null</code>
 *   {@link LaxContentLengthStrategyHC4#INSTANCE} will be used.
 * @param outgoingContentStrategy outgoing content length strategy. If <code>null</code>
 *   {@link StrictContentLengthStrategyHC4#INSTANCE} will be used.
 */
protected BHttpConnectionBase(
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy) {
    super();
    Args.positive(buffersize, "Buffer size");
    final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
    final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
    this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
            constraints != null ? constraints : MessageConstraints.DEFAULT, chardecoder);
    this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize, fragmentSizeHint,
            charencoder);
    this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
    this.incomingContentStrategy = incomingContentStrategy != null ? incomingContentStrategy :
        LaxContentLengthStrategyHC4.INSTANCE;
    this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
        StrictContentLengthStrategyHC4.INSTANCE;
}
项目:Visit    文件:LoggingManagedHttpClientConnection.java   
public LoggingManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(id, buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.wire = new WireHC4(id);
}
项目:Visit    文件:DefaultManagedHttpClientConnection.java   
public DefaultManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.id = id;
    this.attributes = new ConcurrentHashMap<String, Object>();
}
项目:Visit    文件:SessionInputBufferImpl.java   
/**
 * Creates new instance of SessionInputBufferImpl.
 *
 * @param metrics HTTP transport metrics.
 * @param buffersize buffer size. Must be a positive number.
 * @param minChunkLimit size limit below which data chunks should be buffered in memory
 *   in order to minimize native method invocations on the underlying network socket.
 *   The optimal value of this parameter can be platform specific and defines a trade-off
 *   between performance of memory copy operations and that of native method invocation.
 *   If negative default chunk limited will be used.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param chardecoder chardecoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 */
public SessionInputBufferImpl(
        final HttpTransportMetricsImpl metrics,
        final int buffersize,
        final int minChunkLimit,
        final MessageConstraints constraints,
        final CharsetDecoder chardecoder) {
    Args.notNull(metrics, "HTTP transport metrcis");
    Args.positive(buffersize, "Buffer size");
    this.metrics = metrics;
    this.buffer = new byte[buffersize];
    this.bufferpos = 0;
    this.bufferlen = 0;
    this.minChunkLimit = minChunkLimit >= 0 ? minChunkLimit : 512;
    this.constraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.linebuffer = new ByteArrayBuffer(buffersize);
    this.decoder = chardecoder;
}
项目:ZTLib    文件:BHttpConnectionBase.java   
/**
 * Creates new instance of BHttpConnectionBase.
 *
 * @param buffersize buffer size. Must be a positive number.
 * @param fragmentSizeHint fragment size hint.
 * @param chardecoder decoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 * @param charencoder encoder to be used for encoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for char to byte conversion.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param incomingContentStrategy incoming content length strategy. If <code>null</code>
 *   {@link LaxContentLengthStrategyHC4#INSTANCE} will be used.
 * @param outgoingContentStrategy outgoing content length strategy. If <code>null</code>
 *   {@link StrictContentLengthStrategyHC4#INSTANCE} will be used.
 */
protected BHttpConnectionBase(
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy) {
    super();
    Args.positive(buffersize, "Buffer size");
    final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
    final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
    this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
            constraints != null ? constraints : MessageConstraints.DEFAULT, chardecoder);
    this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize, fragmentSizeHint,
            charencoder);
    this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
    this.incomingContentStrategy = incomingContentStrategy != null ? incomingContentStrategy :
        LaxContentLengthStrategyHC4.INSTANCE;
    this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
        StrictContentLengthStrategyHC4.INSTANCE;
}
项目:ZTLib    文件:LoggingManagedHttpClientConnection.java   
public LoggingManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(id, buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.wire = new WireHC4(id);
}
项目:ZTLib    文件:DefaultManagedHttpClientConnection.java   
public DefaultManagedHttpClientConnection(
        final String id,
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy,
            requestWriterFactory, responseParserFactory);
    this.id = id;
    this.attributes = new ConcurrentHashMap<String, Object>();
}
项目:ZTLib    文件:SessionInputBufferImpl.java   
/**
 * Creates new instance of SessionInputBufferImpl.
 *
 * @param metrics HTTP transport metrics.
 * @param buffersize buffer size. Must be a positive number.
 * @param minChunkLimit size limit below which data chunks should be buffered in memory
 *   in order to minimize native method invocations on the underlying network socket.
 *   The optimal value of this parameter can be platform specific and defines a trade-off
 *   between performance of memory copy operations and that of native method invocation.
 *   If negative default chunk limited will be used.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param chardecoder chardecoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 */
public SessionInputBufferImpl(
        final HttpTransportMetricsImpl metrics,
        final int buffersize,
        final int minChunkLimit,
        final MessageConstraints constraints,
        final CharsetDecoder chardecoder) {
    Args.notNull(metrics, "HTTP transport metrcis");
    Args.positive(buffersize, "Buffer size");
    this.metrics = metrics;
    this.buffer = new byte[buffersize];
    this.bufferpos = 0;
    this.bufferlen = 0;
    this.minChunkLimit = minChunkLimit >= 0 ? minChunkLimit : 512;
    this.constraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.linebuffer = new ByteArrayBuffer(buffersize);
    this.decoder = chardecoder;
}
项目:git-as-svn    文件:ProtobufRpcSocket.java   
private void acceptClient(@NotNull Socket client) throws IOException {
  final SessionInputBuffer inputBuffer = wrapInputStream(client.getInputStream());
  final HttpMessageParser<HttpRequest> parser = new DefaultHttpRequestParser(inputBuffer,
      new BasicLineParser(),
      new DefaultHttpRequestFactory(),
      MessageConstraints.DEFAULT
  );
  final SessionOutputBuffer outputBuffer = wrapOutputStream(client.getOutputStream());
  final HttpMessageWriter<HttpResponse> writer = new DefaultHttpResponseWriter(outputBuffer);
  while (!socket.isClosed()) {
    try {
      service(inputBuffer, outputBuffer, parser, writer);
    } catch (ConnectionClosedException ignored) {
      break;
    } catch (HttpException e) {
      log.error(e.getMessage(), e);
      break;
    }
  }
}
项目:fdk-java    文件:HttpEventCodec.java   
HttpEventCodec(Map<String, String> env, InputStream input, OutputStream output) {

        this.env = env;

        SessionInputBufferImpl sib = new SessionInputBufferImpl(new HttpTransportMetricsImpl(), 65535);
        sib.bind(Objects.requireNonNull(input));
        this.sib = sib;

        SessionOutputBufferImpl sob = new SessionOutputBufferImpl(new HttpTransportMetricsImpl(), 65535);
        sob.bind(output);
        this.sob = sob;

        parser = new DefaultHttpRequestParserFactory(null, null).create(sib, MessageConstraints.custom().setMaxHeaderCount(65535).setMaxLineLength(65535).build());
    }
项目:remote-files-sync    文件:HttpParamConfig.java   
public static ConnectionConfig getConnectionConfig(final HttpParams params) {
    final MessageConstraints messageConstraints = getMessageConstraints(params);
    final String csname = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
    return ConnectionConfig.custom()
            .setCharset(csname != null ? Charset.forName(csname) : null)
            .setMessageConstraints(messageConstraints)
            .build();
}
项目:remote-files-sync    文件:DefaultBHttpClientConnection.java   
public DefaultBHttpClientConnection(
        final int buffersize,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints) {
    this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
}
项目:remote-files-sync    文件:DefaultBHttpServerConnection.java   
public DefaultBHttpServerConnection(
        final int buffersize,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints) {
    this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
}
项目:remote-files-sync    文件:AbstractMessageParserHC4.java   
/**
 * Creates new instance of AbstractMessageParserHC4.
 *
 * @param buffer the session input buffer.
 * @param lineParser the line parser. If <code>null</code> {@link BasicLineParserHC4#INSTANCE}
 *   will be used.
 * @param constraints the message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 *
 * @since 4.3
 */
public AbstractMessageParserHC4(
        final SessionInputBuffer buffer,
        final LineParser lineParser,
        final MessageConstraints constraints) {
    super();
    this.sessionBuffer = Args.notNull(buffer, "Session input buffer");
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.messageConstraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.headerLines = new ArrayList<CharArrayBuffer>();
    this.state = HEAD_LINE;
}
项目:purecloud-iot    文件:SessionInputBufferMock.java   
public SessionInputBufferMock(
        final InputStream instream,
        final int buffersize,
        final MessageConstraints constrains,
        final CharsetDecoder decoder) {
    super(new HttpTransportMetricsImpl(), buffersize, -1, constrains, decoder);
    bind(instream);
}
项目:purecloud-iot    文件:SessionInputBufferMock.java   
public SessionInputBufferMock(
        final byte[] bytes,
        final int buffersize,
        final MessageConstraints constrains,
        final CharsetDecoder decoder) {
    this(new ByteArrayInputStream(bytes), buffersize, constrains, decoder);
}
项目:message_interface    文件:HttpClientPool.java   
private static CloseableHttpClient client() {
    PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
    cm.setDefaultMaxPerRoute(100);
    cm.setMaxTotal(400);

    MessageConstraints messageConstraints = MessageConstraints.custom()
            .setMaxHeaderCount(200)
            .setMaxLineLength(2000)
            .build();

    ConnectionConfig connectionConfig = ConnectionConfig.custom()
            .setMalformedInputAction(CodingErrorAction.IGNORE)
            .setUnmappableInputAction(CodingErrorAction.IGNORE)
            .setCharset(Consts.UTF_8)
            .setMessageConstraints(messageConstraints)
            .build();

    RequestConfig defaultRequestConfig = RequestConfig.custom()
            .setSocketTimeout(5000)
            .setConnectTimeout(5000)
            .setConnectionRequestTimeout(5000)
            .build();

    cm.setDefaultConnectionConfig(connectionConfig);

    return HttpClients.custom()
            .setConnectionManager(cm)
            .setDefaultRequestConfig(defaultRequestConfig)
            .build();
}
项目:Visit    文件:HttpParamConfig.java   
public static ConnectionConfig getConnectionConfig(final HttpParams params) {
    final MessageConstraints messageConstraints = getMessageConstraints(params);
    final String csname = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
    return ConnectionConfig.custom()
            .setCharset(csname != null ? Charset.forName(csname) : null)
            .setMessageConstraints(messageConstraints)
            .build();
}
项目:Visit    文件:DefaultBHttpClientConnection.java   
public DefaultBHttpClientConnection(
        final int buffersize,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints) {
    this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
}
项目:Visit    文件:DefaultBHttpServerConnection.java   
public DefaultBHttpServerConnection(
        final int buffersize,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints) {
    this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
}
项目:Visit    文件:AbstractMessageParserHC4.java   
/**
 * Creates new instance of AbstractMessageParserHC4.
 *
 * @param buffer the session input buffer.
 * @param lineParser the line parser. If <code>null</code> {@link BasicLineParserHC4#INSTANCE}
 *   will be used.
 * @param constraints the message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 *
 * @since 4.3
 */
public AbstractMessageParserHC4(
        final SessionInputBuffer buffer,
        final LineParser lineParser,
        final MessageConstraints constraints) {
    super();
    this.sessionBuffer = Args.notNull(buffer, "Session input buffer");
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.messageConstraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.headerLines = new ArrayList<CharArrayBuffer>();
    this.state = HEAD_LINE;
}
项目:cosmo    文件:SimpleUrlContentReader.java   
private CloseableHttpClient buildClient(int timeoutInMillis, URL url) {
    RequestConfig config = RequestConfig.custom().setConnectionRequestTimeout(timeoutInMillis)
            .setConnectTimeout(timeoutInMillis).setRedirectsEnabled(true).setMaxRedirects(MAX_REDIRECTS)
            .setProxy(this.proxyFactory.getProxy(url)).build();
    return HttpClientBuilder.create().setDefaultRequestConfig(config)
            .setDefaultConnectionConfig(
                    ConnectionConfig
                            .custom().setMessageConstraints(MessageConstraints.custom()
                                    .setMaxHeaderCount(MAX_HEADER_COUNT).setMaxLineLength(MAX_LINE_LENGTH).build())
                            .build())
            .build();
}
项目:ZTLib    文件:HttpParamConfig.java   
public static ConnectionConfig getConnectionConfig(final HttpParams params) {
    final MessageConstraints messageConstraints = getMessageConstraints(params);
    final String csname = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
    return ConnectionConfig.custom()
            .setCharset(csname != null ? Charset.forName(csname) : null)
            .setMessageConstraints(messageConstraints)
            .build();
}
项目:ZTLib    文件:DefaultBHttpClientConnection.java   
public DefaultBHttpClientConnection(
        final int buffersize,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints) {
    this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
}
项目:ZTLib    文件:DefaultBHttpServerConnection.java   
public DefaultBHttpServerConnection(
        final int buffersize,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints) {
    this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
}
项目:ZTLib    文件:AbstractMessageParserHC4.java   
/**
 * Creates new instance of AbstractMessageParserHC4.
 *
 * @param buffer the session input buffer.
 * @param lineParser the line parser. If <code>null</code> {@link BasicLineParserHC4#INSTANCE}
 *   will be used.
 * @param constraints the message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 *
 * @since 4.3
 */
public AbstractMessageParserHC4(
        final SessionInputBuffer buffer,
        final LineParser lineParser,
        final MessageConstraints constraints) {
    super();
    this.sessionBuffer = Args.notNull(buffer, "Session input buffer");
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.messageConstraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.headerLines = new ArrayList<CharArrayBuffer>();
    this.state = HEAD_LINE;
}
项目:remote-files-sync    文件:HttpParamConfig.java   
public static MessageConstraints getMessageConstraints(final HttpParams params) {
    return MessageConstraints.custom()
            .setMaxHeaderCount(params.getIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, -1))
            .setMaxLineLength(params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1))
            .build();
}
项目:remote-files-sync    文件:DefaultBHttpClientConnection.java   
/**
 * Creates new instance of DefaultBHttpClientConnection.
 *
 * @param buffersize buffer size. Must be a positive number.
 * @param fragmentSizeHint fragment size hint.
 * @param chardecoder decoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 * @param charencoder encoder to be used for encoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for char to byte conversion.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param incomingContentStrategy incoming content length strategy. If <code>null</code>
 *   {@link org.apache.http.impl.entity.LaxContentLengthStrategyHC4#INSTANCE} will be used.
 * @param outgoingContentStrategy outgoing content length strategy. If <code>null</code>
 *   {@link org.apache.http.impl.entity.StrictContentLengthStrategyHC4#INSTANCE} will be used.
 * @param requestWriterFactory request writer factory. If <code>null</code>
 *   {@link DefaultHttpRequestWriterFactory#INSTANCE} will be used.
 * @param responseParserFactory response parser factory. If <code>null</code>
 *   {@link DefaultHttpResponseParserFactory#INSTANCE} will be used.
 */
public DefaultBHttpClientConnection(
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super(buffersize, fragmentSizeHint, chardecoder, charencoder,
            constraints, incomingContentStrategy, outgoingContentStrategy);
    this.requestWriter = (requestWriterFactory != null ? requestWriterFactory :
        DefaultHttpRequestWriterFactory.INSTANCE).create(getSessionOutputBuffer());
    this.responseParser = (responseParserFactory != null ? responseParserFactory :
        DefaultHttpResponseParserFactory.INSTANCE).create(getSessionInputBuffer(), constraints);
}
项目:remote-files-sync    文件:DefaultBHttpServerConnection.java   
/**
 * Creates new instance of DefaultBHttpServerConnection.
 *
 * @param buffersize buffer size. Must be a positive number.
 * @param fragmentSizeHint fragment size hint.
 * @param chardecoder decoder to be used for decoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for byte to char conversion.
 * @param charencoder encoder to be used for encoding HTTP protocol elements.
 *   If <code>null</code> simple type cast will be used for char to byte conversion.
 * @param constraints Message constraints. If <code>null</code>
 *   {@link MessageConstraints#DEFAULT} will be used.
 * @param incomingContentStrategy incoming content length strategy. If <code>null</code>
 *   {@link DisallowIdentityContentLengthStrategy#INSTANCE} will be used.
 * @param outgoingContentStrategy outgoing content length strategy. If <code>null</code>
 *   {@link org.apache.http.impl.entity.StrictContentLengthStrategyHC4#INSTANCE} will be used.
 * @param requestParserFactory request parser factory. If <code>null</code>
 *   {@link DefaultHttpRequestParserFactory#INSTANCE} will be used.
 * @param responseWriterFactory response writer factory. If <code>null</code>
 *   {@link DefaultHttpResponseWriterFactory#INSTANCE} will be used.
 */
public DefaultBHttpServerConnection(
        final int buffersize,
        final int fragmentSizeHint,
        final CharsetDecoder chardecoder,
        final CharsetEncoder charencoder,
        final MessageConstraints constraints,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageParserFactory<HttpRequest> requestParserFactory,
        final HttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
    super(buffersize, fragmentSizeHint, chardecoder, charencoder, constraints,
            incomingContentStrategy != null ? incomingContentStrategy :
                DisallowIdentityContentLengthStrategy.INSTANCE, outgoingContentStrategy);
    this.requestParser = (requestParserFactory != null ? requestParserFactory :
        DefaultHttpRequestParserFactory.INSTANCE).create(getSessionInputBuffer(), constraints);
    this.responseWriter = (responseWriterFactory != null ? responseWriterFactory :
        DefaultHttpResponseWriterFactory.INSTANCE).create(getSessionOutputBuffer());
}
项目:remote-files-sync    文件:DefaultHttpResponseParserFactory.java   
public HttpMessageParser create(final SessionInputBuffer buffer,
        final MessageConstraints constraints) {
    return new DefaultHttpResponseParser(buffer, lineParser, responseFactory, constraints);
}
项目:remote-files-sync    文件:DefaultHttpResponseParserFactory.java   
public HttpMessageParser create(final SessionInputBuffer buffer,
        final MessageConstraints constraints) {
    return new DefaultHttpResponseParser(buffer, lineParser, responseFactory, constraints);
}
项目:remote-files-sync    文件:DefaultHttpResponseParser.java   
/**
 * @since 4.3
 */
public DefaultHttpResponseParser(
        final SessionInputBuffer buffer,
        final MessageConstraints constraints) {
    this(buffer, null, null, constraints);
}
项目:remote-files-sync    文件:DefaultHttpResponseParser.java   
/**
 * @since 4.3
 */
public DefaultHttpResponseParser(final SessionInputBuffer buffer) {
    this(buffer, null, null, MessageConstraints.DEFAULT);
}
项目:remote-files-sync    文件:DefaultHttpRequestParserFactory.java   
public HttpMessageParser create(final SessionInputBuffer buffer,
        final MessageConstraints constraints) {
    return new DefaultHttpRequestParser(buffer, lineParser, requestFactory, constraints);
}