From 95cf30652662f8bbbe5ca0ec1867985a56887737 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Fri, 31 Dec 2010 13:14:57 +0000
Subject: [PATCH]     * i2psnark: Send cache directive for in-war icons

---
 .../java/src/org/klomp/snark/web/I2PSnarkServlet.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index a570de2d06..cfe95df13b 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -99,6 +99,17 @@ public class I2PSnarkServlet extends Default {
         return _resourceBase.addPath(pathInContext);
     }
 
+    /**
+     *  Tell the browser to cache the icons
+     *  @since 0.8.3
+     */
+    @Override
+    public void handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash) throws ServletException, IOException {
+        if (resource.getName().startsWith("jar:file:"))
+            response.setHeader("Cache-Control", "max-age=86400");  // cache for a day
+        super.handleGet(request, response, pathInContext, resource, endsWithSlash);
+    }
+
     /**
      * Some parts modified from:
      * <pre>
-- 
GitLab