如何使用 map 和 flatMap 将下面的 java 代码转换或编写为响应式 webflux。并且需要 (ResponseEntity<byte[]>) 返回类型

问题描述 投票:0回答:0
How to convert or write below java code to reactive webflux using map & flatMap . And i need the 

(ResponseEntity) 返回类型


public ResponseEntity<byte[]> printQRVCT() throws JRException, IOException {
        System.out.println("printQRVCT-------------------called");
        Map<String, Object> vehiclePassParams = new HashMap<>();
        vehiclePassParams.put("jobNumber", "JOB1");
        String jasperFilePath = "classpath:reports/VehiclePassQRCode.jrxml";
        JasperPrint jasperPrint = JasperReportGenerator.buildJasperReport(jasperFilePath, vehiclePassParams);
        String fileName = "VehiclePassQRCode.pdf";
        httpHeaders = new HttpHeaders();
        httpHeaders.setContentType(MediaType.APPLICATION_PDF);
        httpHeaders.setContentDispositionFormData("fileName", fileName);`your text`
        return new ResponseEntity<byte[]>(JasperExportManager.exportReportToPdf(jasperPrint), httpHeaders,HttpStatus.OK);

需要使用 map & flatmap 转换为 webflux

need to convert as webflux using map & flatmap
spring stream spring-webflux
© www.soinside.com 2019 - 2024. All rights reserved.