Source:
public Response download(@ApiParam(value = "The storageId", required = true) @PathParam("storageId") String storageId, @ApiParam(value = "The repositoryId", required = true) @PathParam("repositoryId") String repositoryId, @ApiParam(value = "The path to the artifact", required = true) @PathParam("path") String path, @Context HttpServletRequest request, @Context HttpHeaders headers) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, AuthenticationException { logger.debug(" repository = " + repositoryId + ", path = " + path); Storage storage = getConfiguration().getStorage(storageId); Repository repository = storage.getRepository(repositoryId); if (!repository.isInService()) { logger.error("Repository is not in service..."); return Response.status(Response.Status.SERVICE_UNAVAILABLE).build(); } Response.ResponseBuilder responseBuilder; if (repository.allowsDirectoryBrowsing() && probeForDirectoryListing(repository, path)) { logger.debug("GenerateDirectoryListing..."); try { return generateDirectoryListing(repository, path, request); } catch (Exception e){ logger.error("Unable to GenerateDirectoryListing", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } InputStream is; try { if (isRangedRequest(headers)) { is = getArtifactManagementService().resolve(storageId, repositoryId, path); responseBuilder = handlePartialDownload((ArtifactInputStream) is, headers); } else { is = getArtifactManagementService().resolve(storageId, repositoryId, path); responseBuilder = Response.ok(is); } } catch (ArtifactResolutionException | ArtifactTransportException e) { logger.error("Unable to download", e); return Response.status(Response.Status.NOT_FOUND).build(); } setMediaTypeHeader(path, responseBuilder); responseBuilder.header("Accept-Ranges", "bytes"); setHeadersForChecksums(storageId, repositoryId, path, responseBuilder); logger.debug("Download success. Building response..."); return responseBuilder.build(); }

Target:
public Response download(@ApiParam(value = "The storageId", required = true) @PathParam("storageId") String storageId, @ApiParam(value = "The repositoryId", required = true) @PathParam("repositoryId") String repositoryId, @ApiParam(value = "The path to the artifact", required = true) @PathParam("path") String path, @Context HttpServletRequest request, @Context HttpHeaders headers) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, AuthenticationException, ProviderImplementationException { logger.debug(" repository = " + repositoryId + ", path = " + path); Storage storage = getConfiguration().getStorage(storageId); Repository repository = storage.getRepository(repositoryId); if (!repository.isInService()) { logger.error("Repository is not in service..."); return Response.status(Response.Status.SERVICE_UNAVAILABLE).build(); } Response.ResponseBuilder responseBuilder; if (repository.allowsDirectoryBrowsing() && probeForDirectoryListing(repository, path)) { logger.debug("GenerateDirectoryListing..."); try { return generateDirectoryListing(repository, path, request); } catch (Exception e){ logger.error("Unable to GenerateDirectoryListing", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } InputStream is; try { if (isRangedRequest(headers)) { is = getArtifactManagementService().resolve(storageId, repositoryId, path); responseBuilder = handlePartialDownload((ArtifactInputStream) is, headers); } else { is = getArtifactManagementService().resolve(storageId, repositoryId, path); responseBuilder = Response.ok(is); } } catch (ArtifactResolutionException | ArtifactTransportException e) { logger.error("Unable to download", e); return Response.status(Response.Status.NOT_FOUND).build(); } setMediaTypeHeader(path, responseBuilder); responseBuilder.header("Accept-Ranges", "bytes"); setHeadersForChecksums(storageId, repositoryId, path, responseBuilder); logger.debug("Download success. Building response..."); return responseBuilder.build(); }