类org.apache.commons.httpclient.HttpConstants源码实例Demo

下面列出了怎么用org.apache.commons.httpclient.HttpConstants的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jrpip   文件: StreamedPostMethod.java
protected void flushCache() throws IOException
{
    if (this.cachePosition > 0)
    {
        this.writeHeaders();
        byte[] chunkHeader = HttpConstants.getBytes(
                Integer.toHexString(this.cachePosition) + "\r\n");
        this.stream.write(chunkHeader, 0, chunkHeader.length);
        this.stream.write(this.cache, 0, this.cachePosition);
        this.stream.write(ENDCHUNK, 0, ENDCHUNK.length);
        this.cachePosition = 0;
    }
}
 
源代码2 项目: jrpip   文件: StreamedPostMethod.java
protected void flushCacheWithAppend(byte[] bufferToAppend, int off, int len) throws IOException
{
    this.writeHeaders();
    byte[] chunkHeader = HttpConstants.getBytes(
            Integer.toHexString(this.cachePosition + len) + "\r\n");
    this.stream.write(chunkHeader, 0, chunkHeader.length);
    this.stream.write(this.cache, 0, this.cachePosition);
    this.stream.write(bufferToAppend, off, len);
    this.stream.write(ENDCHUNK, 0, ENDCHUNK.length);
    this.cachePosition = 0;
}
 
源代码3 项目: pinpoint   文件: HttpClient3EntityExtractor.java
@Override
public String getEntity(HttpMethod httpMethod) {
    if (httpMethod instanceof EntityEnclosingMethod) {
        final EntityEnclosingMethod entityEnclosingMethod = (EntityEnclosingMethod) httpMethod;
        final RequestEntity entity = entityEnclosingMethod.getRequestEntity();
        if (entity != null && entity.isRepeatable() && entity.getContentLength() > 0) {
            try {
                String entityValue;
                String charSet = entityEnclosingMethod.getRequestCharSet();
                if (StringUtils.isEmpty(charSet)) {
                    charSet = HttpConstants.DEFAULT_CONTENT_CHARSET;
                }
                if (entity instanceof ByteArrayRequestEntity || entity instanceof StringRequestEntity) {
                    entityValue = entityUtilsToString(entity, charSet);
                } else {
                    entityValue = entity.getClass() + " (ContentType:" + entity.getContentType() + ")";
                }
                return entityValue;
            } catch (Exception e) {
                if (isDebug) {
                    logger.debug("Failed to get entity. httpMethod={}", httpMethod, e);
                }
            }
        }
    }
    return null;
}
 
 类方法
 同包方法