/** * Returns the stream as a result considering "Range" header. If the header is present and * it is satisfiable, then a Result containing just the requested part will be returned. * If the header is not present or is unsatisfiable, then a regular Result will be returned. * * @param request the request from which to retrieve the range header. * @param entityLength the entityLength * @param source source of the entity * @param fileName filename used at the Content-Disposition header * @param contentType the content type for this stream * @return range result if "Range" header is present and regular result if not */ public static Result ofSource(Http.Request request, Long entityLength, Source<ByteString, ?> source, String fileName, String contentType) { return JavaRangeResult.ofSource(entityLength, source, rangeHeader(request), Optional.ofNullable(fileName), Optional.ofNullable(contentType)); } }
/** * Returns the stream as a result considering "Range" header. If the header is present and * it is satisfiable, then a Result containing just the requested part will be returned. * If the header is not present or is unsatisfiable, then a regular Result will be returned. * * @param request the request from which to retrieve the range header. * @param entityLength the entityLength * @param source source of the entity * @param fileName filename used at the Content-Disposition header * @param contentType the content type for this stream * @return range result if "Range" header is present and regular result if not */ public static Result ofSource(Http.Request request, Long entityLength, Source<ByteString, ?> source, String fileName, String contentType) { return JavaRangeResult.ofSource(entityLength, source, rangeHeader(request), Optional.ofNullable(fileName), Optional.ofNullable(contentType)); } }
/** * Returns the stream as a result considering "Range" header. If the header is present and * it is satisfiable, then a Result containing just the requested part will be returned. * If the header is not present or is unsatisfiable, then a regular Result will be returned. * * @param request the request from which to retrieve the range header. * @param entityLength the entityLength * @param source source of the entity * @param fileName filename used at the Content-Disposition header * @param contentType the content type for this stream * @return range result if "Range" header is present and regular result if not */ public static Result ofSource(Http.Request request, Long entityLength, Source<ByteString, ?> source, String fileName, String contentType) { return JavaRangeResult.ofSource(entityLength, source, rangeHeader(request), Optional.ofNullable(fileName), Optional.ofNullable(contentType)); } }