int from = Math.max(request.mandatoryParamAsInt("from"), 1);
int to = (Integer) ObjectUtils.defaultIfNull(request.paramAsInt("to"), Integer.MAX_VALUE);
List<String> sourceHtml = sourceService.getLinesAsHtml(fileKey, from, to);
if (sourceHtml == null) {
throw new NotFoundException("File '" + fileKey + "' has no sources");
}
JsonWriter json = response.newJsonWriter().beginObject();
writeSource(sourceHtml, from, json);