本文整理汇总了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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例5: DefaultHttpResponseParser
/**
* @since 4.3
*/
public DefaultHttpResponseParser(final SessionInputBuffer buffer) {
this(buffer, null, null, MessageConstraints.DEFAULT);
}
示例6: DefaultHttpRequestParser
/**
* @since 4.3
*/
public DefaultHttpRequestParser(final SessionInputBuffer buffer) {
this(buffer, null, null, MessageConstraints.DEFAULT);
}
示例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;
}
示例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);
}