From d8021ad0dd618e63a40b515a85206b44cec2375e Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 6 Dec 2002 08:12:42 +0000 Subject: [PATCH] add no-cache Pragma and Cache-control headers to the http response.. I see no reason why not to do this as nothing in Mir should be cached and I have been annoyed to many times by opera and IE caching stuff not to do this. It has to be in the http headers and not in the Meta tags as some browsers have problems.. --- source/Mir.java | 13 ++++++++++--- source/OpenMir.java | 11 ++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/source/Mir.java b/source/Mir.java index e24619fa..afb33512 100755 --- a/source/Mir.java +++ b/source/Mir.java @@ -67,7 +67,7 @@ import mir.log.Log; * Mir.java - main servlet, that dispatches to servletmodules * * @author $Author: mh $ - * @version $Id: Mir.java,v 1.22 2002/11/04 04:35:20 mh Exp $ + * @version $Id: Mir.java,v 1.23 2002/12/06 08:12:42 mh Exp $ * */ @@ -95,11 +95,10 @@ public class Mir extends AbstractServlet { EntityUsers userEntity; String http = ""; - // get the configration - this could conflict if 2 mirs are in the - // VM maybe? to be checked. -mh if (getServletContext().getAttribute("mir.confed") == null) { getConfig(req); } + MirConfig.setServletName(getServletName()); //*** test @@ -109,6 +108,14 @@ public class Mir extends AbstractServlet { userEntity = (EntityUsers) session.getAttribute("login.uid"); if (req.getServerPort() == 443) http = "https"; else http = "http"; + + //nothing in Mir can or should be cached as it's all dynamic... + // + //this needs to be done here and not per page (via meta tags) as some + //browsers have problems w/ it per-page -mh + res.setHeader("Pragma", "no-cache"); + res.setDateHeader("Expires", 0); + res.setHeader("Cache-Control", "no-cache"); res.setContentType("text/html; charset=" +MirConfig.getProp("Mir.DefaultEncoding")); String moduleName = req.getParameter("module"); diff --git a/source/OpenMir.java b/source/OpenMir.java index 2c6f0920..81902800 100755 --- a/source/OpenMir.java +++ b/source/OpenMir.java @@ -50,7 +50,8 @@ import mircoders.storage.*; /** * OpenMir.java - main servlet for open posting and comment feature to articles * - * @author RK 1999-2001 + * @author RK 1999-2001, the mir-coders group + * @version $Id: OpenMir.java,v 1.16 2002/12/06 08:12:42 mh Exp $ * */ @@ -79,6 +80,7 @@ public class OpenMir extends AbstractServlet { if(getServletContext().getAttribute("mir.confed") == null) { getConfig(req); } + session = req.getSession(); if(session.getAttribute("Language")==null){ @@ -93,6 +95,13 @@ public class OpenMir extends AbstractServlet { if (req.getParameter("language")!=null) setLocale(session, new Locale(req.getParameter("language"), "") ); + //nothing in Mir can or should be cached as it's all dynamic... + // + //this needs to be done here and not per page (via meta tags) as some + //browsers have problems w/ it per-page -mh + res.setHeader("Pragma", "no-cache"); + res.setDateHeader("Expires", 0); + res.setHeader("Cache-Control", "no-cache"); res.setContentType("text/html; charset=" +MirConfig.getProp("Mir.DefaultEncoding")); try { -- 2.11.0