1 36 37 package com.caucho.doc.javadoc; 38 39 import com.caucho.log.Log; 40 import com.caucho.util.L10N; 41 42 import java.util.logging.Logger ; 43 44 import javax.servlet.http.HttpServletResponse ; 45 import javax.servlet.jsp.JspException ; 46 import javax.servlet.http.HttpServletRequest ; 47 48 51 public class JspUtil { 52 static protected final Logger log = Log.open(JspUtil.class); 53 static final L10N L = new L10N(JspUtil.class); 54 55 private HttpServletRequest _request; 56 private HttpServletResponse _response; 57 58 private Store _store; 59 60 public JspUtil() 61 { 62 } 63 64 public void setRequest(HttpServletRequest request) 65 { 66 _request = request; 67 } 68 69 public void setResponse(HttpServletResponse response) 70 { 71 _response = response; 72 } 73 74 77 public Store getStore() 78 throws JspException 79 { 80 if (_store == null) { 81 try { 82 _store = Store.getInstance(); 83 } catch (Exception ex) { 84 throw new JspException (ex); 85 } 86 } 87 88 return _store; 89 } 90 91 95 public void sendHttpCacheHeaders() 96 throws JspException 97 { 98 Store store = getStore(); 99 100 long period = getStore().getHttpCachePeriod(); 101 102 if (period < 0) { 103 _response.setHeader("Cache-Control","no-cache,post-check=0,pre-check=0,no-store"); 105 _response.setHeader("Pragma","no-cache"); 106 _response.setHeader("Expires","Thu,01Dec199416:00:00GMT"); 107 } else { 108 long now = System.currentTimeMillis(); 109 _response.setDateHeader("Expires", now + period); 110 } 111 } 112 113 } 114 115 | Popular Tags |