try {
rackResponse = context.getRackResponse().withBody(file).withContentLength(file.length());
if (configuration != null) {
Map<String, String> customMimeTypes = (Map<String, String>) configuration.get(CONFIG_ELEMENT_MIME_TYPES);
if (!CollectionUtils.isEmpty(customMimeTypes) && customMimeTypes.containsKey(fileType)) {
rackResponse.withContentType(customMimeTypes.get(fileType));
} else {
rackResponse.withContentType(Mime.mimeType(fileType));
}
} else {
rackResponse.withContentType(Mime.mimeType(fileType));