Setting the Expires Header in Java Servlet
Posted on 1998-12-17
Can someone please give me the exact Java code to place the expires header in a Java servlet that would make it expire exactly 1 hour from now. Also, how compatible is this header with browsers?
I ask for the exact code because I have code that already does it, I thought, but it doesn't work. Sometimes netscape (perhaps others) will continually re-request to the servlet again and again when I use the code below:
dateNow.setTime( dateNow.getTime() + (1000*60*60) );
res.setHeader( "Expires", dateNow.toGMTString() );