@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); if (contentType != null) { sb.append("Content-Type: "); sb.append(contentType.getValue()); sb.append(','); } if (contentEncoding != null) { sb.append("Content-Encoding: "); sb.append(contentEncoding.getValue()); sb.append(','); } final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(chunked); sb.append(']'); return sb.toString(); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); if (contentType != null) { sb.append("Content-Type: "); sb.append(contentType.getValue()); sb.append(','); } if (contentEncoding != null) { sb.append("Content-Encoding: "); sb.append(contentEncoding.getValue()); sb.append(','); } final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(chunked); sb.append(']'); return sb.toString(); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); if (contentType != null) { sb.append("Content-Type: "); sb.append(contentType.getValue()); sb.append(','); } if (contentEncoding != null) { sb.append("Content-Encoding: "); sb.append(contentEncoding.getValue()); sb.append(','); } final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(chunked); sb.append(']'); return sb.toString(); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); if (contentType != null) { sb.append("Content-Type: "); sb.append(contentType.getValue()); sb.append(','); } if (contentEncoding != null) { sb.append("Content-Encoding: "); sb.append(contentEncoding.getValue()); sb.append(','); } final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(chunked); sb.append(']'); return sb.toString(); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('['); if (contentType != null) { sb.append("Content-Type: "); sb.append(contentType.getValue()); sb.append(','); } if (contentEncoding != null) { sb.append("Content-Encoding: "); sb.append(contentEncoding.getValue()); sb.append(','); } final long len = getContentLength(); if (len >= 0) { sb.append("Content-Length: "); sb.append(len); sb.append(','); } sb.append("Chunked: "); sb.append(chunked); sb.append(']'); return sb.toString(); }
public static HttpEntity buildInputStreamEntity(final ODataClient client, final InputStream input) { AbstractHttpEntity entity; boolean useChunked = client.getConfiguration().isUseChuncked(); if (shouldUseRepeatableHttpBodyEntry(client) || !useChunked) { byte[] bytes = new byte[0]; try { bytes = IOUtils.toByteArray(input); IOUtils.closeQuietly(input); } catch (IOException e) { throw new ODataRuntimeException("While reading input for not chunked encoding", e); } entity = new ByteArrayEntity(bytes); } else { entity = new InputStreamEntity(input, -1); } if (!useChunked && entity.getContentLength() < 0) { useChunked = true; } // both entities can be sent in chunked way or not entity.setChunked(useChunked); return entity; }
public static HttpEntity buildInputStreamEntity(final ODataClient client, final InputStream input) { AbstractHttpEntity entity; boolean useChunked = client.getConfiguration().isUseChuncked(); if (shouldUseRepeatableHttpBodyEntry(client) || !useChunked) { byte[] bytes = new byte[0]; try { bytes = IOUtils.toByteArray(input); IOUtils.closeQuietly(input); } catch (IOException e) { throw new ODataRuntimeException("While reading input for not chunked encoding", e); } entity = new ByteArrayEntity(bytes); } else { entity = new InputStreamEntity(input, -1); } if (!useChunked && entity.getContentLength() < 0) { useChunked = true; } // both entities can be sent in chunked way or not entity.setChunked(useChunked); return entity; }