package net.sourceforge.jsurveyor.tags;

import javax.servlet.http.*;
import javax.servlet.jsp.tagext.*;

/**
 * Various browser instructions to prevent caching.
 * @version 1.0
 * @author Claus Methmann Christensen
 * @author Anders Spliid Hansen
 * @author Esben Iversen Hansen
 * @author Lars H Jensen
 * @author Marcus Overheu
 * @author Thomas Ramdal
 * @author Peter Thomsen
 */
public class NoCacheTag extends TagSupport {

	/**
	 * Automatically called when closing the tag. 
	 * Sets no cache page headers
	 * @return int
	 * @see javax.servlet.jsp.tagext.Tag#doEndTag()
	 * 
	 */
	public int doEndTag() {
		HttpServletResponse response =
			(HttpServletResponse) pageContext.getResponse();
		response.addHeader("Pragma", "No-Cache");
		response.setHeader("Cache-Control", "No-Cache");
		response.setDateHeader("Expires", 0);
		return EVAL_PAGE;
	}

}