• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ContentLengthStrategy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.http.entity.ContentLengthStrategy的典型用法代码示例。如果您正苦于以下问题:Java ContentLengthStrategy类的具体用法?Java ContentLengthStrategy怎么用?Java ContentLengthStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: BHttpConnectionBase

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
/**
 * 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,代码行数:39,代码来源:BHttpConnectionBase.java


示例2: LoggingManagedHttpClientConnection

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
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);
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:17,代码来源:LoggingManagedHttpClientConnection.java


示例3: DefaultManagedHttpClientConnection

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
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>();
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:18,代码来源:DefaultManagedHttpClientConnection.java


示例4: ManagedHttpClientConnectionFactory

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
/**
 * @since 4.4
 */
public ManagedHttpClientConnectionFactory(
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy) {
    super();
    this.requestWriterFactory = requestWriterFactory != null ? requestWriterFactory :
            DefaultHttpRequestWriterFactory.INSTANCE;
    this.responseParserFactory = responseParserFactory != null ? responseParserFactory :
            DefaultHttpResponseParserFactory.INSTANCE;
    this.incomingContentStrategy = incomingContentStrategy != null ? incomingContentStrategy :
            LaxContentLengthStrategy.INSTANCE;
    this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
            StrictContentLengthStrategy.INSTANCE;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:19,代码来源:ManagedHttpClientConnectionFactory.java


示例5: LoggingManagedHttpClientConnection

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
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);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:22,代码来源:LoggingManagedHttpClientConnection.java


示例6: receiveRequest

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public HttpRequest receiveRequest() throws HttpException, IOException {
    HttpRequest request = (HttpRequest) this.requestParser.parse();
    if (HEADERLOG.isDebugEnabled()) {
        HEADERLOG.debug(">> " + request.getRequestLine().toString());
        for (HeaderIterator it = request.headerIterator(); it.hasNext(); ) {
            HEADERLOG.debug(">> " + it.nextHeader().toString());
        }
    }
    
    // Prepare input stream
    this.in = null;
    if (request instanceof HttpEntityEnclosingRequest) {
        long len = this.contentLenStrategy.determineLength(request);
        if (len == ContentLengthStrategy.CHUNKED) {
            this.in = new ChunkedInputStream(this.inbuffer);
        } else if (len == ContentLengthStrategy.IDENTITY) {
            this.in = new IdentityInputStream(this.inbuffer);                            
        } else {
            this.in = new ContentLengthInputStream(inbuffer, len);
        }
    }
    return request;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:AxisHttpConnectionImpl.java


示例7: EntityDeserializer

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public EntityDeserializer(final ContentLengthStrategy lenStrategy) {
    super();
    if (lenStrategy == null) {
        throw new IllegalArgumentException("Content length strategy may not be null");
    }
    this.lenStrategy = lenStrategy;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:EntityDeserializer.java


示例8: doDeserialize

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
/**
 * Creates a {@link BasicHttpEntity} based on properties of the given
 * message. The content of the entity is created by wrapping
 * {@link SessionInputBuffer} with a content decoder depending on the
 * transfer mechanism used by the message.
 * <p>
 * This method is called by the public
 * {@link #deserialize(SessionInputBuffer, HttpMessage)}.
 *
 * @param inbuffer the session input buffer.
 * @param message the message.
 * @return HTTP entity.
 * @throws HttpException in case of HTTP protocol violation.
 * @throws IOException in case of an I/O error.
 */
protected BasicHttpEntity doDeserialize(
        final SessionInputBuffer inbuffer,
        final HttpMessage message) throws HttpException, IOException {
    BasicHttpEntity entity = new BasicHttpEntity();

    long len = this.lenStrategy.determineLength(message);
    if (len == ContentLengthStrategy.CHUNKED) {
        entity.setChunked(true);
        entity.setContentLength(-1);
        entity.setContent(new ChunkedInputStream(inbuffer));
    } else if (len == ContentLengthStrategy.IDENTITY) {
        entity.setChunked(false);
        entity.setContentLength(-1);
        entity.setContent(new IdentityInputStream(inbuffer));
    } else {
        entity.setChunked(false);
        entity.setContentLength(len);
        entity.setContent(new ContentLengthInputStream(inbuffer, len));
    }

    Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
    if (contentTypeHeader != null) {
        entity.setContentType(contentTypeHeader);
    }
    Header contentEncodingHeader = message.getFirstHeader(HTTP.CONTENT_ENCODING);
    if (contentEncodingHeader != null) {
        entity.setContentEncoding(contentEncodingHeader);
    }
    return entity;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:EntityDeserializer.java


示例9: determineLength

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public long determineLength(final HttpMessage message) throws HttpException {
    long result = this.contentLengthStrategy.determineLength(message);
    if (result == ContentLengthStrategy.IDENTITY) {
        throw new ProtocolException("Identity transfer encoding cannot be used");
    }
    return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:DisallowIdentityContentLengthStrategy.java


示例10: EntitySerializer

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public EntitySerializer(final ContentLengthStrategy lenStrategy) {
    super();
    if (lenStrategy == null) {
        throw new IllegalArgumentException("Content length strategy may not be null");
    }
    this.lenStrategy = lenStrategy;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:EntitySerializer.java


示例11: determineLength

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public long determineLength(final HttpMessage message) throws HttpException {
    final long result = this.contentLengthStrategy.determineLength(message);
    if (result == ContentLengthStrategy.IDENTITY) {
        throw new ProtocolException("Identity transfer encoding cannot be used");
    }
    return result;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:8,代码来源:DisallowIdentityContentLengthStrategy.java


示例12: DefaultBHttpClientConnectionFactory

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public DefaultBHttpClientConnectionFactory(
        final ConnectionConfig cconfig,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
        final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
    super();
    this.cconfig = cconfig != null ? cconfig : ConnectionConfig.DEFAULT;
    this.incomingContentStrategy = incomingContentStrategy;
    this.outgoingContentStrategy = outgoingContentStrategy;
    this.requestWriterFactory = requestWriterFactory;
    this.responseParserFactory = responseParserFactory;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:14,代码来源:DefaultBHttpClientConnectionFactory.java


示例13: createOutputStream

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
protected OutputStream createOutputStream(
        final long len,
        final SessionOutputBuffer outbuffer) {
    if (len == ContentLengthStrategy.CHUNKED) {
        return new ChunkedOutputStreamHC4(2048, outbuffer);
    } else if (len == ContentLengthStrategy.IDENTITY) {
        return new IdentityOutputStreamHC4(outbuffer);
    } else {
        return new ContentLengthOutputStreamHC4(outbuffer, len);
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:12,代码来源:BHttpConnectionBase.java


示例14: createInputStream

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
protected InputStream createInputStream(
        final long len,
        final SessionInputBuffer inbuffer) {
    if (len == ContentLengthStrategy.CHUNKED) {
        return new ChunkedInputStreamHC4(inbuffer);
    } else if (len == ContentLengthStrategy.IDENTITY) {
        return new IdentityInputStreamHC4(inbuffer);
    } else {
        return new ContentLengthInputStreamHC4(inbuffer, len);
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:12,代码来源:BHttpConnectionBase.java


示例15: prepareInput

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
protected HttpEntity prepareInput(final HttpMessage message) throws HttpException {
    final BasicHttpEntityHC4 entity = new BasicHttpEntityHC4();

    final long len = this.incomingContentStrategy.determineLength(message);
    final InputStream instream = createInputStream(len, this.inbuffer);
    if (len == ContentLengthStrategy.CHUNKED) {
        entity.setChunked(true);
        entity.setContentLength(-1);
        entity.setContent(instream);
    } else if (len == ContentLengthStrategy.IDENTITY) {
        entity.setChunked(false);
        entity.setContentLength(-1);
        entity.setContent(instream);
    } else {
        entity.setChunked(false);
        entity.setContentLength(len);
        entity.setContent(instream);
    }

    final Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
    if (contentTypeHeader != null) {
        entity.setContentType(contentTypeHeader);
    }
    final Header contentEncodingHeader = message.getFirstHeader(HTTP.CONTENT_ENCODING);
    if (contentEncodingHeader != null) {
        entity.setContentEncoding(contentEncodingHeader);
    }
    return entity;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:30,代码来源:BHttpConnectionBase.java


示例16: DefaultBHttpServerConnectionFactory

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public DefaultBHttpServerConnectionFactory(
        final ConnectionConfig cconfig,
        final ContentLengthStrategy incomingContentStrategy,
        final ContentLengthStrategy outgoingContentStrategy,
        final HttpMessageParserFactory<HttpRequest> requestParserFactory,
        final HttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
    super();
    this.cconfig = cconfig != null ? cconfig : ConnectionConfig.DEFAULT;
    this.incomingContentStrategy = incomingContentStrategy;
    this.outgoingContentStrategy = outgoingContentStrategy;
    this.requestParserFactory = requestParserFactory;
    this.responseWriterFactory = responseWriterFactory;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:14,代码来源:DefaultBHttpServerConnectionFactory.java


示例17: createOutputStream

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
@Override
protected OutputStream createOutputStream(final long len, final SessionOutputBuffer outbuffer) {
    if (len == ContentLengthStrategy.CHUNKED) {
        return new ChunkedOutputStream(chunkSize, outbuffer);
    }
    return super.createOutputStream(len, outbuffer);
}
 
开发者ID:fod-dev,项目名称:FoDBugTrackerUtility,代码行数:8,代码来源:ApacheConnector.java


示例18: DisallowIdentityContentLengthStrategy

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
public DisallowIdentityContentLengthStrategy(final ContentLengthStrategy contentLengthStrategy) {
    super();
    this.contentLengthStrategy = contentLengthStrategy;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:DisallowIdentityContentLengthStrategy.java


示例19: DefaultBHttpClientConnection

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:38,代码来源:DefaultBHttpClientConnection.java


示例20: DefaultBHttpServerConnection

import org.apache.http.entity.ContentLengthStrategy; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:39,代码来源:DefaultBHttpServerConnection.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RegistryToggleState类代码示例发布时间:2022-05-22
下一篇:
Java DCEndPosTree类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap