diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java index 4dc6f1eb5c..45b55c1637 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java @@ -293,7 +293,8 @@ class HttpPluginServlet extends HttpServlet } if (!exists(entry) && file.endsWith("/index.html")) { String pfx = file.substring(0, file.length() - "index.html".length()); - sendAutoIndex(jar, pfx, holder.plugin.getName(), key, res); + sendAutoIndex(jar, pfx, holder.plugin.getName(), key, res, + holder.plugin.getSrcFile().lastModified()); } else if (exists(entry) && entry.getName().endsWith(".md")) { sendMarkdownAsHtml(jar, entry, holder.plugin.getName(), key, res); } else if (exists(entry)) { @@ -335,7 +336,8 @@ class HttpPluginServlet extends HttpServlet private void sendAutoIndex(JarFile jar, String prefix, String pluginName, - ResourceKey cacheKey, HttpServletResponse res) throws IOException { + ResourceKey cacheKey, HttpServletResponse res, long lastModifiedTime) + throws IOException { List cmds = Lists.newArrayList(); List servlets = Lists.newArrayList(); List restApis = Lists.newArrayList(); @@ -411,11 +413,11 @@ class HttpPluginServlet extends HttpServlet appendEntriesSection(jar, restApis, "REST APIs", md, prefix, "rest-api-".length()); appendEntriesSection(jar, cmds, "Commands", md, prefix, "cmd-".length()); - sendMarkdownAsHtml(md.toString(), pluginName, cacheKey, res); + sendMarkdownAsHtml(md.toString(), pluginName, cacheKey, res, lastModifiedTime); } private void sendMarkdownAsHtml(String md, String pluginName, - ResourceKey cacheKey, HttpServletResponse res) + ResourceKey cacheKey, HttpServletResponse res, long lastModifiedTime) throws UnsupportedEncodingException, IOException { Map macros = Maps.newHashMap(); macros.put("PLUGIN", pluginName); @@ -446,7 +448,8 @@ class HttpPluginServlet extends HttpServlet .markdownToDocHtml(sb.toString(), "UTF-8"); resourceCache.put(cacheKey, new SmallResource(html) .setContentType("text/html") - .setCharacterEncoding("UTF-8")); + .setCharacterEncoding("UTF-8") + .setLastModified(lastModifiedTime)); res.setContentType("text/html"); res.setCharacterEncoding("UTF-8"); res.setContentLength(html.length); @@ -535,7 +538,7 @@ class HttpPluginServlet extends HttpServlet if (0 < time) { res.setDateHeader("Last-Modified", time); } - sendMarkdownAsHtml(txtmd, pluginName, key, res); + sendMarkdownAsHtml(txtmd, pluginName, key, res, time); } private void sendResource(JarFile jar, JarEntry entry,