当前位置: 首页>>代码示例>>Java>>正文


Java MessageConstraints.DEFAULT属性代码示例

本文整理汇总了Java中org.apache.http.config.MessageConstraints.DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java MessageConstraints.DEFAULT属性的具体用法?Java MessageConstraints.DEFAULT怎么用?Java MessageConstraints.DEFAULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.http.config.MessageConstraints的用法示例。


在下文中一共展示了MessageConstraints.DEFAULT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BHttpConnectionBase

/**
 * 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;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:38,代码来源:BHttpConnectionBase.java

示例2: SessionInputBufferImpl

/**
 * 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;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:32,代码来源:SessionInputBufferImpl.java

示例3: acceptClient

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;
    }
  }
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:20,代码来源:ProtobufRpcSocket.java

示例4: AbstractMessageParserHC4

/**
 * 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;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:22,代码来源:AbstractMessageParserHC4.java

示例5: DefaultHttpResponseParser

/**
 * @since 4.3
 */
public DefaultHttpResponseParser(final SessionInputBuffer buffer) {
    this(buffer, null, null, MessageConstraints.DEFAULT);
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:6,代码来源:DefaultHttpResponseParser.java

示例6: DefaultHttpRequestParser

/**
 * @since 4.3
 */
public DefaultHttpRequestParser(final SessionInputBuffer buffer) {
    this(buffer, null, null, MessageConstraints.DEFAULT);
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:6,代码来源:DefaultHttpRequestParser.java

示例7: ChunkedInputStream

/**
 * Wraps session input stream and reads chunk coded input.
 *
 * @param in The session input buffer
 * @param constraints Message constraints. If {@code null}
 *   {@link MessageConstraints#DEFAULT} will be used.
 *
 * @since 4.4
 */
public ChunkedInputStream(final SessionInputBuffer in, final MessageConstraints constraints) {
    super();
    this.in = Args.notNull(in, "Session input buffer");
    this.pos = 0L;
    this.buffer = new CharArrayBuffer(16);
    this.constraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
    this.state = CHUNK_LEN;
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:17,代码来源:ChunkedInputStream.java

示例8: DefaultHttpResponseParser

/**
 * Creates new instance of DefaultHttpResponseParser.
 *
 * @param buffer the session input buffer.
 *
 * @since 4.3
 */
public DefaultHttpResponseParser(final SessionInputBuffer buffer) {
    this(buffer, null, null, MessageConstraints.DEFAULT);
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:10,代码来源:DefaultHttpResponseParser.java


注:本文中的org.apache.http.config.MessageConstraints.DEFAULT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。