org.apache.commons.httpclient.HttpConstants Java Examples
The following examples show how to use
org.apache.commons.httpclient.HttpConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StreamedPostMethod.java From jrpip with Apache License 2.0 | 5 votes |
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; } }
Example #2
Source File: StreamedPostMethod.java From jrpip with Apache License 2.0 | 5 votes |
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; }
Example #3
Source File: HttpClient3EntityExtractor.java From pinpoint with Apache License 2.0 | 5 votes |
@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; }