Search in sources :

Example 1 with LengthBasedContentWriterFactory

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);
}
Also used : LengthBasedContentWriterFactory(co.cask.cdap.data.stream.service.upload.LengthBasedContentWriterFactory) StreamConfig(co.cask.cdap.data2.transaction.stream.StreamConfig)

Aggregations

LengthBasedContentWriterFactory (co.cask.cdap.data.stream.service.upload.LengthBasedContentWriterFactory)1 StreamConfig (co.cask.cdap.data2.transaction.stream.StreamConfig)1