Source:
private void downloadLicenseInfo(ResourceRequest request, ResourceResponse response) throws IOException { final User user = UserCacheHolder.getUserFromRequest(request); final String projectId = request.getParameter(PROJECT_ID); final String generatorClassName = request.getParameter(PortalConstants.LICENSE_INFO_SELECTED_OUTPUT_FORMAT); final Map<String, Set<String>> selectedReleaseAndAttachmentIds = ProjectPortletUtils .getSelectedReleaseAndAttachmentIdsFromRequest(request); final Set<String> attachmentIds = selectedReleaseAndAttachmentIds.values().stream().flatMap(Collection::stream) .collect(Collectors.toSet()); final Map<String, Set<LicenseNameWithText>> excludedLicensesPerAttachmentId = ProjectPortletUtils .getExcludedLicensesPerAttachmantIdFromRequest(attachmentIds, request); try { final LicenseInfoService.Iface licenseInfoClient = thriftClients.makeLicenseInfoClient(); final ProjectService.Iface projectClient = thriftClients.makeProjectClient(); Project project = projectClient.getProjectById(projectId, user); LicenseInfoFile licenseInfoFile = licenseInfoClient.getLicenseInfoFile(project, user, generatorClassName, selectedReleaseAndAttachmentIds, excludedLicensesPerAttachmentId); OutputFormatInfo outputFormatInfo = licenseInfoFile.getOutputFormatInfo(); String filename = String.format("LicenseInfo-%s-%s.%s", project.getName(), SW360Utils.getCreatedOn(), outputFormatInfo.getFileExtension()); String mimetype = outputFormatInfo.getMimeType(); if (isNullOrEmpty(mimetype)) { mimetype = URLConnection.guessContentTypeFromName(filename); } PortletResponseUtil.sendFile(request, response, filename, licenseInfoFile.getGeneratedOutput(), mimetype); } catch (TException e) { log.error("Error getting LicenseInfo file for project with id " + projectId + " and generator " + generatorClassName, e); response.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); } }

Target:
private void downloadLicenseInfo(ResourceRequest request, ResourceResponse response) throws IOException { final User user = UserCacheHolder.getUserFromRequest(request); final String projectId = request.getParameter(PROJECT_ID); final String generatorClassName = request.getParameter(PortalConstants.LICENSE_INFO_SELECTED_OUTPUT_FORMAT); final Map<String, Set<String>> selectedReleaseAndAttachmentIds = ProjectPortletUtils .getSelectedReleaseAndAttachmentIdsFromRequest(request); final Set<String> attachmentIds = selectedReleaseAndAttachmentIds.values().stream().flatMap(Collection::stream) .collect(Collectors.toSet()); final Map<String, Set<LicenseNameWithText>> excludedLicensesPerAttachmentId = ProjectPortletUtils .getExcludedLicensesPerAttachmentIdFromRequest(attachmentIds, request); try { final LicenseInfoService.Iface licenseInfoClient = thriftClients.makeLicenseInfoClient(); final ProjectService.Iface projectClient = thriftClients.makeProjectClient(); Project project = projectClient.getProjectById(projectId, user); LicenseInfoFile licenseInfoFile = licenseInfoClient.getLicenseInfoFile(project, user, generatorClassName, selectedReleaseAndAttachmentIds, excludedLicensesPerAttachmentId); OutputFormatInfo outputFormatInfo = licenseInfoFile.getOutputFormatInfo(); String filename = String.format("LicenseInfo-%s-%s.%s", project.getName(), SW360Utils.getCreatedOn(), outputFormatInfo.getFileExtension()); String mimetype = outputFormatInfo.getMimeType(); if (isNullOrEmpty(mimetype)) { mimetype = URLConnection.guessContentTypeFromName(filename); } PortletResponseUtil.sendFile(request, response, filename, licenseInfoFile.getGeneratedOutput(), mimetype); } catch (TException e) { log.error("Error getting LicenseInfo file for project with id " + projectId + " and generator " + generatorClassName, e); response.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); } }