entityToBuild.setChunked(true);
httpEntity.setChunked(Boolean.parseBoolean(chunkedRequestEntity));
httpEntity.setChunked(Boolean.parseBoolean(chunkedRequestEntity));
httpEntity.setChunked(Boolean.parseBoolean(chunkedRequestEntity));
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; }
httpEntity.setChunked(Boolean.parseBoolean(chunkedRequestEntity));
/** * Build the HttpEntity to be sent to the Service as part of (POST) request. Creates a off-memory * {@link FileExposingFileEntity} or a regular in-memory {@link ByteArrayEntity} depending on if the request * OutputStream fit into memory when built by calling. * * @param request - * @return - the built HttpEntity * @throws IOException - */ protected HttpEntity buildEntity(final ClientInvocation request) throws IOException { AbstractHttpEntity entityToBuild = null; DeferredFileOutputStream memoryManagedOutStream = writeRequestBodyToOutputStream(request); if (memoryManagedOutStream.isInMemory()) { ByteArrayEntity entityToBuildByteArray = new ByteArrayEntity(memoryManagedOutStream.getData()); entityToBuildByteArray.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, request.getHeaders().getMediaType().toString())); entityToBuild = entityToBuildByteArray; } else { entityToBuild = new FileExposingFileEntity(memoryManagedOutStream.getFile(), request.getHeaders().getMediaType().toString()); } if (request.isChunked()) { entityToBuild.setChunked(true); } return (HttpEntity) entityToBuild; }
/** * Build the HttpEntity to be sent to the Service as part of (POST) request. Creates a off-memory * {@link FileExposingFileEntity} or a regular in-memory {@link ByteArrayEntity} depending on if the request * OutputStream fit into memory when built by calling. * * @param request - * @return - the built HttpEntity * @throws IOException - */ protected HttpEntity buildEntity(final ClientInvocation request) throws IOException { AbstractHttpEntity entityToBuild = null; DeferredFileOutputStream memoryManagedOutStream = writeRequestBodyToOutputStream(request); if (memoryManagedOutStream.isInMemory()) { ByteArrayEntity entityToBuildByteArray = new ByteArrayEntity(memoryManagedOutStream.getData()); entityToBuildByteArray.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, request.getHeaders().getMediaType().toString())); entityToBuild = entityToBuildByteArray; } else { entityToBuild = new FileExposingFileEntity(memoryManagedOutStream.getFile(), request.getHeaders().getMediaType().toString()); } if (request.isChunked()) { entityToBuild.setChunked(true); } return (HttpEntity) entityToBuild; }
e.setChunked(this.chunked); if (this.gzipCompress) { return new GzipCompressingEntity(e);
e.setChunked(this.chunked); if (this.gzipCompress) { return new GzipCompressingEntity(e);
e.setChunked(this.chunked); if (this.gzipCompress) { return new GzipCompressingEntity(e);
e.setChunked(this.chunked); if (this.gzipCompress) { return new GzipCompressingEntity(e);
e.setChunked(this.chunked); if (this.gzipCompress) { return new GzipCompressingEntity(e);
e.setChunked(this.chunked); if (this.gzipCompress) { return new GzipCompressingEntity(e);