1 package com.genimen.djeneric.web.util; 2 3 import javax.servlet.ServletConfig ; 4 import javax.servlet.ServletException ; 5 import javax.servlet.http.HttpServlet ; 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 public abstract class DjenericServlet extends HttpServlet 10 { 11 12 protected ServletConfig _config = null; 13 14 public void init(ServletConfig config) throws ServletException 15 { 16 super.init(config); 17 18 _config = config; 19 } 20 21 protected void disableBrowserCaching(HttpServletResponse response) 22 { 23 response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); } 27 28 protected String getContextroot(HttpServletRequest request) 29 { 30 return request.getContextPath(); 31 } 32 33 protected String getConfig(String paramName) 34 { 35 return _config.getInitParameter(paramName); 36 } 37 38 } | Popular Tags |