Repository: syncope
Updated Branches:
  refs/heads/2_0_X 24444a770 -> e3760ec00


[SYNCOPE-1272] Set browser cache duration to NONE for 
ResourceStreamRequestHandler


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e3760ec0
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e3760ec0
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e3760ec0

Branch: refs/heads/2_0_X
Commit: e3760ec0076139e307a1a21adced73a66e088171
Parents: 24444a7
Author: Marco Di Sabatino Di Diodoro <marco.disabat...@tirasa.net>
Authored: Mon Feb 12 11:38:18 2018 +0100
Committer: Marco Di Sabatino Di Diodoro <marco.disabat...@tirasa.net>
Committed: Mon Feb 12 11:38:18 2018 +0100

----------------------------------------------------------------------
 .../java/org/apache/syncope/client/console/pages/BasePage.java   | 2 ++
 .../console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java   | 4 +++-
 .../client/console/wicket/markup/html/form/AjaxDownload.java     | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/e3760ec0/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
index e8f1fb9..59659a2 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
@@ -64,6 +64,7 @@ import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.ContentDisposition;
+import org.apache.wicket.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -135,6 +136,7 @@ public class BasePage extends WebPage implements 
IAjaxIndicatorAware {
                             ? SyncopeConsoleSession.get().getDomain() + 
"Content.xml"
                             : stream.getFilename());
                     rsrh.setContentDisposition(ContentDisposition.ATTACHMENT);
+                    rsrh.setCacheDuration(Duration.NONE);
 
                     getRequestCycle().scheduleRequestHandlerAfterCurrent(rsrh);
                 } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/e3760ec0/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
index 9342c7d..004f7c8 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
@@ -22,6 +22,7 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.behavior.AbstractAjaxBehavior;
 import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
 import org.apache.wicket.util.resource.IResourceStream;
+import org.apache.wicket.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,7 +46,8 @@ public abstract class AbstractAjaxDownloadBehavior extends 
AbstractAjaxBehavior
     public void onRequest() {
         try {
             
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(
-                    new ResourceStreamRequestHandler(getResourceStream(), 
getFileName()));
+                    new ResourceStreamRequestHandler(
+                            getResourceStream(), 
getFileName()).setCacheDuration(Duration.NONE));
         } catch (Exception e) {
             // cannot be notifies beacause the use of 
scheduleRequestHandlerAfterCurrent
             LOG.error("Error downloading file", e);

http://git-wip-us.apache.org/repos/asf/syncope/blob/e3760ec0/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDownload.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDownload.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDownload.java
index da27e2b..6ede95f 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDownload.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDownload.java
@@ -27,6 +27,7 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.behavior.AbstractAjaxBehavior;
 import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
 import org.apache.wicket.request.resource.ContentDisposition;
+import org.apache.wicket.util.time.Duration;
 
 public abstract class AjaxDownload extends AbstractAjaxBehavior {
 
@@ -79,6 +80,7 @@ public abstract class AjaxDownload extends 
AbstractAjaxBehavior {
 
         handler.setFileName(fileName);
         handler.setContentDisposition(ContentDisposition.ATTACHMENT);
+        handler.setCacheDuration(Duration.NONE);
         
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
     }
 

Reply via email to