i have ws method which return a byte [] so i did this to force the download of returned file
final byte[] content = axisService.getWebFileContent(pieceJointe.getVlidnlfy()); if (content != null) { final Map<String, Object> lrFile = new HashMap<>(2); lrFile.put("CONTENT", content); lrFile.put("MIMETYPE", "application/octet-stream"); response.reset(); response.resetBuffer(); response.setContentType("application/force-download"); response.setHeader("Content-Transfer-Encoding", "binary"); response.setHeader("Content-Disposition", "attachment; filename=\"" + pieceJointe.getLbnompcj() + "\"");// fileName); response.getOutputStream().write((byte[]) lrFile.get("CONTENT")); response.setContentLength(((byte[]) lrFile.get("CONTENT")).length); response.getOutputStream().close(); response.flushBuffer(); but it doesn't work and i dont have any error in my console , is there any configuration to add to my response ?