01: /**
02: * $Id: NoCacheTag.java,v 1.2 2004/03/22 10:57:36 pg133018 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.util;
14:
15: import javax.servlet.jsp.*;
16: import javax.servlet.http.*;
17:
18: import com.sun.portal.wireless.taglibs.base.*;
19:
20: /**
21: * NoCacheTag
22: *
23: * @version 1.0
24: */
25:
26: public class NoCacheTag extends BaseTagSupport {
27:
28: public int doStartTag() throws JspException {
29: HttpServletResponse res = (HttpServletResponse) pageContext
30: .getResponse();
31:
32: try {
33: res.setHeader("Cache-Control",
34: "no-cache, no-store, must-revalidate, max-age=0");
35: res.setHeader("Pragma", "no-cache");
36: } catch (Exception e) {
37: // Accomodate various behaviours of the servlet engine when
38: // attempting to set headers from within an included resource.
39: // Essentially..., ignore the error. This allows us to have
40: // JSPs that operate in a standalone fashion as well as in
41: // the "include" case.
42: }
43:
44: return SKIP_BODY;
45: }
46: }
|