src/main/java/org/edgegallery/appstore/interfaces/apackage/facade/PushablePackageServiceFacade.java
public ResponseEntity<InputStreamResource> downloadPackage(String packageId, String targetAppstore)
        throws FileNotFoundException {
        PushablePackageDto packageDto = pushablePackageService.getPushablePackage(packageId);
        // add message log for this action
        recordLog(packageDto, targetAppstore);
        Release release = appService.download(packageDto.getAppId(), packageId);
        String fileName = appUtil.getFileName(release, release.getPackageFile());
        InputStream ins = fileService.get(release.getPackageFile());
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/octet-stream");
        headers.add("Content-Disposition", "attachment; filename=" + fileName);
        return ResponseEntity.ok().headers(headers).body(new InputStreamResource(ins));
    }
/**
     * download a package by id.
     *
     * @param packageId id
     * @return file stream
     * @throws FileNotFoundException e
     */
download a package by id.
@param packageId id
@return file stream
@throws FileNotFoundException e
download a package by id . @param packageId id @return file stream @throws FileNotFoundException e
public ResponseEntity<InputStreamResource> downloadPackage(String packageId, String targetAppstore)
        throws FileNotFoundException {
        PushablePackageDto packageDto = pushablePackageService.getPushablePackage(packageId);
        recordLog(packageDto, targetAppstore);
        Release release = appService.download(packageDto.getAppId(), packageId);
        String fileName = appUtil.getFileName(release, release.getPackageFile());
        InputStream ins = fileService.get(release.getPackageFile());
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/octet-stream");
        headers.add("Content-Disposition", "attachment; filename=" + fileName);
        return ResponseEntity.ok().headers(headers).body(new InputStreamResource(ins));
    }
public ResponseEntity < InputStreamResource > downloadPackage ( String packageId , String targetAppstore ) throws FileNotFoundException { PushablePackageDto packageDto = pushablePackageService . getPushablePackage ( packageId ) ; recordLog ( packageDto , targetAppstore ) ; Release release = appService . download ( packageDto . getAppId ( ) , packageId ) ; String fileName = appUtil . getFileName ( release , release . getPackageFile ( ) ) ; InputStream ins = fileService . get ( release . getPackageFile ( ) ) ; HttpHeaders headers = new HttpHeaders ( ) ; headers . add ( "Content-Type" , "application/octet-stream" ) ; headers . add ( "Content-Disposition" , "attachment; filename=" + fileName ) ; return ResponseEntity . ok ( ) . headers ( headers ) . body ( new InputStreamResource ( ins ) ) ; }
download a package by id.
download a package by id .
// add message log for this action