Commits

la...@81dbac14-341a-0410-aa85-cbcd92e6f43e  committed bd71f28

CACHE-315 support for Content-Disposition Response Header

  • Participants
  • Parent commits c51d171

Comments (0)

Files changed (3)

File src/java/com/opensymphony/oscache/web/filter/CacheFilter.java

     public static final String HEADER_CACHE_CONTROL = "Cache-Control";
     public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
     public static final String HEADER_ETAG = "ETag";
+    public static final String HEADER_CONTENT_DISPOSITION = "Content-Disposition";
 
     // Fragment parameter
     public static final int FRAGMENT_AUTODETECT = -1;

File src/java/com/opensymphony/oscache/web/filter/CacheHttpServletResponseWrapper.java

         if (CacheFilter.HEADER_ETAG.equalsIgnoreCase(name)) {
             result.setETag(value);
         }
+        
+        if (CacheFilter.HEADER_CONTENT_DISPOSITION.equalsIgnoreCase(name)) {
+            result.setContentDisposition(value);
+        }
 
         super.setHeader(name, value);
     }
             result.setETag(value);
         }
 
+        if (CacheFilter.HEADER_CONTENT_DISPOSITION.equalsIgnoreCase(name)) {
+            result.setContentDisposition(value);
+        }
+
         super.addHeader(name, value);
     }
 

File src/java/com/opensymphony/oscache/web/filter/ResponseContent.java

     private long lastModified = -1;
     private long maxAge = -60;
     private String etag = null;
+    private String contentDisposition = null;
 
     public String getContentType() {
         return contentType;
         this.etag = etag;
     }
 
+    public String getContentDisposition() {
+        return contentDisposition;
+    }
+
+    public void setContentDisposition(String contentDisposition) {
+        this.contentDisposition = contentDisposition;
+    }
+
    /**
      * Set the Locale. We capture this so that when we serve this data from
      * cache, we can set the correct locale on the response.
                     httpResponse.addHeader(CacheFilter.HEADER_ETAG, etag);
                 }
                 
+                // add the content disposition header
+                if(contentDisposition != null) {
+                    httpResponse.addHeader(CacheFilter.HEADER_CONTENT_DISPOSITION, contentDisposition);
+                }
+                
                 // add the expires header
                 if (expires != Long.MAX_VALUE) {
                     httpResponse.setDateHeader(CacheFilter.HEADER_EXPIRES, expires);