IOUtils.closeQuietly(in); String contentType = MimeTypes.getMimeType(url.getPath()); if (!MimeTypes.DEFAULT_TYPE.equals(contentType)) { resp.setHeader("Content-Type", contentType);
@GET @Path(WorkingFileRepository.COLLECTION_PATH_PREFIX + "{collectionId}/{fileName}") @RestQuery(name = "getFromCollection", description = "Gets the file from the working repository under /collectionId/filename", returnDescription = "The file", pathParameters = { @RestParameter(name = "collectionId", description = "the collection identifier", isRequired = true, type = STRING), @RestParameter(name = "fileName", description = "the file name", isRequired = true, type = STRING) }, reponses = { @RestResponse(responseCode = SC_OK, description = "File returned"), @RestResponse(responseCode = SC_NOT_FOUND, description = "Not found") }) public Response restGetFromCollection(@PathParam("collectionId") String collectionId, @PathParam("fileName") String fileName) throws NotFoundException { return fileResponse(getFileFromCollection(collectionId, fileName), getMimeType(fileName), some(fileName)) .build(); }
String contentType = MimeTypes.getMimeType(normalized); if (!MimeTypes.DEFAULT_TYPE.equals(contentType)) { resp.setContentType(contentType);
if (StringUtils.isNotBlank(range)) { logger.debug("trying to retrieve range: {}", range); return partialFileResponse(getFile(mediaPackageID, mediaPackageElementID), getMimeType(fileName), some(fileName), range).tag(md5).build(); return fileResponse(getFile(mediaPackageID, mediaPackageElementID), getMimeType(fileName), some(fileName)).tag(md5).build();