diff --git a/lib/repo/ch/autumo/beetroot/autumo-beetroot/3.1.0/autumo-beetroot-3.1.0.jar b/lib/repo/ch/autumo/beetroot/autumo-beetroot/3.1.0/autumo-beetroot-3.1.0.jar index 1ed515f3..d6a25410 100644 Binary files a/lib/repo/ch/autumo/beetroot/autumo-beetroot/3.1.0/autumo-beetroot-3.1.0.jar and b/lib/repo/ch/autumo/beetroot/autumo-beetroot/3.1.0/autumo-beetroot-3.1.0.jar differ diff --git a/src/main/java/ch/autumo/beetroot/handler/BaseHandler.java b/src/main/java/ch/autumo/beetroot/handler/BaseHandler.java index 9c33ae0a..faa52eb5 100644 --- a/src/main/java/ch/autumo/beetroot/handler/BaseHandler.java +++ b/src/main/java/ch/autumo/beetroot/handler/BaseHandler.java @@ -2046,7 +2046,11 @@ public final Response get(UriResource uriResource, Map urlParams if (!file.exists()) throw new FileNotFoundException("File '"+file.getName()+"' doesn't exist (Download)!"); final Response downloadResponse = Response.newFixedLengthResponse(getStatus(), mime, new FileInputStream(file), file.length()); - downloadResponse.addHeader("Content-disposition", "attachment; filename=" +file.getName()); + String fName = response.getDownloadFileName(); + if (fName == null || fName.length() == 0) { + fName = file.getName(); + } + downloadResponse.addHeader("Content-disposition", "attachment; filename=" + fName); return downloadResponse; } diff --git a/src/main/java/ch/autumo/beetroot/handler/HandlerResponse.java b/src/main/java/ch/autumo/beetroot/handler/HandlerResponse.java index 20d09c41..6c79b3fb 100644 --- a/src/main/java/ch/autumo/beetroot/handler/HandlerResponse.java +++ b/src/main/java/ch/autumo/beetroot/handler/HandlerResponse.java @@ -42,6 +42,7 @@ public class HandlerResponse { private Exception exception = null; private Object object = null; private File downloadFile = null; + private String downloadFileName = null; private String downloadFileMimeType = null; private Response httpResponse = null; @@ -207,6 +208,14 @@ public void setDownloadFile(File downloadFile) { this.downloadFile = downloadFile; } + public String getDownloadFileName() { + return downloadFileName; + } + + public void setDownloadFileName(String downloadFileName) { + this.downloadFileName = downloadFileName; + } + public String getDownloadFileMimeType() { return downloadFileMimeType; }