use of co.cask.cdap.data.stream.service.upload.LengthBasedContentWriterFactory in project cdap by caskdata.
the class StreamHandler method createContentWriterFactory.
/**
* Creates a {@link ContentWriterFactory} based on the request size. Used by the batch endpoint.
*/
private ContentWriterFactory createContentWriterFactory(StreamId streamId, HttpRequest request) throws IOException {
String contentType = HttpHeaders.getHeader(request, HttpHeaders.Names.CONTENT_TYPE, "");
// The content-type is guaranteed to be non-empty, otherwise the batch request itself will fail.
Map<String, String> headers = getHeaders(request, streamId.getEntityName(), ImmutableMap.<String, String>builder().put("content.type", contentType));
StreamConfig config = streamAdmin.getConfig(streamId);
return new LengthBasedContentWriterFactory(config, streamWriter, headers, batchBufferThreshold, impersonator);
}
Aggregations