mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixes for caching issue with PageRenderer freemarker template processing
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6905 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -174,6 +174,8 @@ public class PageRendererServlet extends WebScriptServlet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setNoCacheHeaders(res);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// lookup template path from page config in website AVM store
|
// lookup template path from page config in website AVM store
|
||||||
@@ -447,6 +449,15 @@ public class PageRendererServlet extends WebScriptServlet
|
|||||||
(page != null ? page + '/' : "") + "page-definition.xml";
|
(page != null ? page + '/' : "") + "page-definition.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the headers required to disallow caching of the response in the browser
|
||||||
|
*/
|
||||||
|
private static void setNoCacheHeaders(HttpServletResponse res)
|
||||||
|
{
|
||||||
|
res.setHeader("Cache-Control", "no-cache");
|
||||||
|
res.setHeader("Pragma", "no-cache");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebScript runtime for the PageRenderer servlet.
|
* WebScript runtime for the PageRenderer servlet.
|
||||||
@@ -707,7 +718,7 @@ public class PageRendererServlet extends WebScriptServlet
|
|||||||
|
|
||||||
public long getLastModified(Object templateSource)
|
public long getLastModified(Object templateSource)
|
||||||
{
|
{
|
||||||
return last--;
|
return last++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reader getReader(Object templateSource, String encoding) throws IOException
|
public Reader getReader(Object templateSource, String encoding) throws IOException
|
||||||
|
@@ -45,5 +45,6 @@ public class PageTemplateProcessor extends TemplateProcessor
|
|||||||
public void initConfig()
|
public void initConfig()
|
||||||
{
|
{
|
||||||
super.initConfig();
|
super.initConfig();
|
||||||
|
templateConfig.setTemplateUpdateDelay(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -94,6 +94,10 @@ public final class ScriptUrlMethod implements TemplateMethodModelEx
|
|||||||
buf.append('&');
|
buf.append('&');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf.append('?');
|
||||||
|
}
|
||||||
buf.append("guest=" + (req.isGuest() ? "true" : ""));
|
buf.append("guest=" + (req.isGuest() ? "true" : ""));
|
||||||
if (req.getFormatStyle() == FormatStyle.argument)
|
if (req.getFormatStyle() == FormatStyle.argument)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user